blob: 989581ac121fd16bea162c88931af7afa50624e1 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* @class storage::TestVisitor
* @ingroup visitors
*
* @brief A visitor used purely for testing the visitor framework.
*
*/
#pragma once
#include "visitor.h"
namespace storage {
class TestVisitor : public Visitor {
public:
TestVisitor(StorageComponent&, const vdslib::Parameters&);
private:
void startingVisitor(const std::vector<document::BucketId>& buckets) override;
void handleDocuments(const document::BucketId& bucketId,
DocEntryList & entries,
HitCounter& hitCounter) override;
void completedBucket(const document::BucketId& bucket, HitCounter& hitCounter) override;
spi::ReadConsistency getRequiredReadConsistency() const override {
return spi::ReadConsistency::WEAK;
}
void completedVisiting(HitCounter& hitCounter) override;
void abortedVisiting() override;
// Send datagram with message back to client
void report(const std::string& message);
std::string _params;
};
struct TestVisitorFactory : public VisitorFactory {
VisitorEnvironment::UP
makeVisitorEnvironment(StorageComponent&) override {
return VisitorEnvironment::UP(new VisitorEnvironment);
};
Visitor*
makeVisitor(StorageComponent& c, VisitorEnvironment&,
const vdslib::Parameters& params) override {
return new TestVisitor(c, params);
}
};
}
|