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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "joinbucketsoperation.h"
#include <vespa/vespalib/util/stringfmt.h>
#include <cassert>
using document::BucketId;
using document::DocumentTypeRepo;
using vespalib::make_string;
namespace proton {
JoinBucketsOperation::JoinBucketsOperation()
: FeedOperation(FeedOperation::JOIN_BUCKETS),
_source1(),
_source2(),
_target()
{
}
JoinBucketsOperation::JoinBucketsOperation(const document::BucketId &source1,
const document::BucketId &source2,
const document::BucketId &target)
: FeedOperation(FeedOperation::JOIN_BUCKETS),
_source1(source1),
_source2(source2),
_target(target)
{
}
void
JoinBucketsOperation::serialize(vespalib::nbostream &os) const
{
{
assert(_source1.valid() || _source2.valid());
assert(_target.valid());
if (_source1.valid()) {
assert(_source1.getUsedBits() > _target.getUsedBits());
assert(_target.contains(_source1));
}
if (_source2.valid()) {
assert(_source2.getUsedBits() > _target.getUsedBits());
assert(_target.contains(_source2));
}
}
os << _source1;
os << _source2;
os << _target;
}
void
JoinBucketsOperation::deserialize(vespalib::nbostream &is,
const DocumentTypeRepo &)
{
is >> _source1;
is >> _source2;
is >> _target;
}
vespalib::string JoinBucketsOperation::toString() const {
return make_string("JoinBuckets(source1=%s, source2=%s, target=%s, "
"serialNum=%" PRIu64 ")",
_source1.toString().c_str(),
_source2.toString().c_str(),
_target.toString().c_str(), getSerialNum());
}
} // namespace proton
|