blob: c4afda1a5ada285dedb2458933de4675c3b8fd1f (
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "testnodestateupdater.h"
#include <vespa/vdslib/state/cluster_state_bundle.h>
namespace storage {
TestNodeStateUpdater::TestNodeStateUpdater(const lib::NodeType& type)
: _reported(new lib::NodeState(type, lib::State::UP)),
_current(new lib::NodeState(type, lib::State::UP)),
_clusterStateBundle(std::make_shared<const lib::ClusterStateBundle>(lib::ClusterState())),
_listeners(),
_explicit_node_state_reply_send_invocations(0)
{ }
TestNodeStateUpdater::~TestNodeStateUpdater() = default;
std::shared_ptr<const lib::ClusterStateBundle>
TestNodeStateUpdater::getClusterStateBundle() const
{
return _clusterStateBundle;
}
void
TestNodeStateUpdater::setClusterState(lib::ClusterState::CSP c)
{
setClusterStateBundle(std::make_shared<const lib::ClusterStateBundle>(*c));
}
void
TestNodeStateUpdater::setClusterStateBundle(std::shared_ptr<const lib::ClusterStateBundle> clusterStateBundle)
{
_clusterStateBundle = std::move(clusterStateBundle);
for (uint32_t i = 0; i < _listeners.size(); ++i) {
_listeners[i]->handleNewState();
}
}
}
|