blob: a8ee0b547134f762f9c52d656dddbdaa884d23b5 (
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
|
// Copyright 2018 Yahoo Holdings. 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 <unordered_map>
#include <iosfwd>
namespace storage::lib {
class ClusterState;
/**
* Class representing the baseline cluster state and the derived cluster
* state for each bucket space.
*/
class ClusterStateBundle
{
public:
using BucketSpaceStateMapping = std::unordered_map<
document::BucketSpace,
std::shared_ptr<const ClusterState>,
document::BucketSpace::hash
>;
std::shared_ptr<const ClusterState> _baselineClusterState;
BucketSpaceStateMapping _derivedBucketSpaceStates;
public:
explicit ClusterStateBundle(const ClusterState &baselineClusterState);
ClusterStateBundle(const ClusterState& baselineClusterState,
BucketSpaceStateMapping derivedBucketSpaceStates);
~ClusterStateBundle();
const std::shared_ptr<const ClusterState> &getBaselineClusterState() const;
const std::shared_ptr<const ClusterState> &getDerivedClusterState(document::BucketSpace bucketSpace) const;
const BucketSpaceStateMapping& getDerivedClusterStates() const noexcept {
return _derivedBucketSpaceStates;
}
uint32_t getVersion() const;
bool operator==(const ClusterStateBundle &rhs) const;
};
std::ostream& operator<<(std::ostream&, const ClusterStateBundle&);
}
|