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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "datagram.h"
#include <ostream>
using document::BucketSpace;
namespace storage {
namespace api {
IMPLEMENT_COMMAND(MapVisitorCommand, MapVisitorReply)
IMPLEMENT_REPLY(MapVisitorReply)
IMPLEMENT_COMMAND(EmptyBucketsCommand, EmptyBucketsReply)
IMPLEMENT_REPLY(EmptyBucketsReply)
MapVisitorCommand::MapVisitorCommand()
: StorageCommand(MessageType::MAPVISITOR)
{
}
void
MapVisitorCommand::print(std::ostream& out, bool verbose,
const std::string& indent) const
{
out << "MapVisitor(" << _statistics.size() << " entries";
if (verbose) {
for (vdslib::Parameters::ParametersMap::const_iterator it
= _statistics.begin(); it != _statistics.end(); ++it)
{
out << ",\n" << indent << " " << it->first << ": "
<< vespalib::stringref(it->second.c_str(), it->second.length());
}
out << ") : ";
StorageCommand::print(out, verbose, indent);
} else {
out << ")";
}
}
MapVisitorReply::MapVisitorReply(const MapVisitorCommand& cmd)
: StorageReply(cmd)
{
}
void
MapVisitorReply::print(std::ostream& out, bool verbose,
const std::string& indent) const
{
out << "MapVisitorReply()";
if (verbose) {
out << " : ";
StorageReply::print(out, verbose, indent);
}
}
EmptyBucketsCommand::EmptyBucketsCommand(
const std::vector<document::BucketId>& buckets)
: StorageCommand(MessageType::EMPTYBUCKETS),
_buckets(buckets)
{
}
void
EmptyBucketsCommand::print(std::ostream& out, bool verbose,
const std::string& indent) const
{
out << "EmptyBuckets(";
if (verbose) {
for (uint32_t i=0; i<_buckets.size(); ++i) {
out << "\n" << indent << " ";
out << _buckets[i];
}
} else {
out << _buckets.size() << " buckets";
}
out << ")";
if (verbose) {
out << " : ";
StorageCommand::print(out, verbose, indent);
}
}
EmptyBucketsReply::EmptyBucketsReply(const EmptyBucketsCommand& cmd)
: StorageReply(cmd)
{
}
void
EmptyBucketsReply::print(std::ostream& out, bool verbose,
const std::string& indent) const
{
out << "EmptyBucketsReply()";
if (verbose) {
out << " : ";
StorageReply::print(out, verbose, indent);
}
}
} // api
} // storage
|