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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/document/bucket/bucketspace.h>
#include <memory>
#include <atomic>
namespace document {
class DocumentTypeRepo;
}
namespace vespalib {
class ThreadStackExecutor;
class nbostream;
}
namespace search::bmcluster {
class AvgSampler;
class BmFeedParams;
class BmRange;
class IBmFeedHandler;
class PendingTracker;
/*
* Class to feed serialized feed operations to a feed handler.
*/
class BmFeeder {
std::shared_ptr<const document::DocumentTypeRepo> _repo;
document::BucketSpace _bucket_space;
IBmFeedHandler& _feed_handler;
vespalib::ThreadStackExecutor& _executor;
vespalib::string _all_fields;
bool _use_timestamp;
std::atomic<bool> _stop;
public:
BmFeeder(std::shared_ptr<const document::DocumentTypeRepo> repo, IBmFeedHandler& feed_handler, vespalib::ThreadStackExecutor& executor);
~BmFeeder();
void feed_operation(uint32_t op_idx, vespalib::nbostream &serialized_feed, int64_t time_bias, PendingTracker& tracker);
uint32_t feed_task(uint32_t max_pending, BmRange range, const vespalib::nbostream &serialized_feed, int64_t time_bias);
void run_feed_tasks(int pass, int64_t& time_bias, const std::vector<vespalib::nbostream>& serialized_feed_v, const BmFeedParams& params, AvgSampler& sampler, const vespalib::string& op_name);
IBmFeedHandler& get_feed_handler() const { return _feed_handler; }
void stop();
void run_feed_tasks_loop(int64_t& time_bias, const std::vector<vespalib::nbostream>& serialized_feed_v, const BmFeedParams& params, const vespalib::string &op_name);
};
}
|