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

#pragma once

#include "storage_api_bm_feed_handler_base.h"
#include <vector>
#include <atomic>

namespace storage::api { class StorageCommand; }

namespace search::bmcluster {

struct BmStorageLinkContext;
class IBmDistribution;

/*
 * Benchmark feed handler for feed to service layer or distributor
 * using storage api protocol directly on the storage chain.
 */
class StorageApiChainBmFeedHandler : public StorageApiBmFeedHandlerBase
{
private:
    std::vector<std::shared_ptr<BmStorageLinkContext>> _contexts;
    std::atomic<uint32_t>                              _no_link_error_count;

    void send_cmd(std::shared_ptr<storage::api::StorageCommand> cmd, PendingTracker& tracker) override;
public:
    StorageApiChainBmFeedHandler(std::vector<std::shared_ptr<BmStorageLinkContext>> contexts, const IBmDistribution& distribution, bool distributor);
    ~StorageApiChainBmFeedHandler();
    void attach_bucket_info_queue(PendingTracker &tracker) override;
    uint32_t get_error_count() const override;
};

}