aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/bmcluster/bm_storage_link.h
blob: b9909dd88bb53d87b2d3697b5ed33695e7a284bf (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "storage_reply_error_checker.h"
#include "pending_tracker_hash.h"
#include <vespa/storage/common/storagelink.h>

namespace search::bmcluster {

class PendingTracker;

/*
 * Storage link used to feed storage api messages to a distributor or
 * service layer node. A count of error replies is maintained.
 */
class BmStorageLink : public storage::StorageLink,
                      public StorageReplyErrorChecker
{
    PendingTrackerHash _pending_hash;
public:
    BmStorageLink();
    ~BmStorageLink() override;
    bool onDown(const std::shared_ptr<storage::api::StorageMessage>& msg) override;
    bool onUp(const std::shared_ptr<storage::api::StorageMessage>& msg) override;
    void retain(uint64_t msg_id, PendingTracker &tracker) { _pending_hash.retain(msg_id, tracker); }
};

}