aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/distributormessagesender.h
blob: ef0252661f34bbccb3dbaf6fc148eb16c8151ba0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/storage/common/cluster_context.h>
#include <vespa/storage/common/messagesender.h>
#include <vespa/vespalib/stllike/string.h>

namespace storage::lib { class NodeType; }
namespace storage::distributor {

class PendingMessageTracker;
class OperationSequencer;

class DistributorMessageSender : public MessageSender {
public:
    /**
      Sends the storage command to the given node,
      returns message id.
     */
    virtual uint64_t sendToNode(const lib::NodeType& nodeType, uint16_t node,
                                const std::shared_ptr<api::StorageCommand>& cmd, bool useDocumentAPI = false);

    virtual int getDistributorIndex() const = 0;
    virtual const ClusterContext& cluster_context() const = 0;
};

class DistributorStripeMessageSender : public DistributorMessageSender {
public:
    virtual PendingMessageTracker& getPendingMessageTracker() = 0;
    virtual const PendingMessageTracker& getPendingMessageTracker() const = 0;
    virtual const OperationSequencer& operation_sequencer() const noexcept = 0;
    virtual OperationSequencer& operation_sequencer() noexcept = 0;
};

}