aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/common/content_bucket_space.cpp
blob: 58f7501d2785e2d6e91abbfd12528354d257d3bc (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "content_bucket_space.h"

namespace storage {

ContentBucketSpace::ContentBucketSpace(document::BucketSpace bucketSpace,
                                       const ContentBucketDbOptions& db_opts)
    : _bucketSpace(bucketSpace),
      _bucketDatabase(db_opts),
      _lock(),
      _clusterState(),
      _distribution(),
      _nodeUpInLastNodeStateSeenByProvider(false),
      _nodeMaintenanceInLastNodeStateSeenByProvider(false)
{
}

void
ContentBucketSpace::setClusterState(std::shared_ptr<const lib::ClusterState> clusterState)
{
    std::lock_guard guard(_lock);
    _clusterState = std::move(clusterState);
}

std::shared_ptr<const lib::ClusterState>
ContentBucketSpace::getClusterState() const
{
    std::lock_guard guard(_lock);
    return _clusterState;
}

void
ContentBucketSpace::setDistribution(std::shared_ptr<const lib::Distribution> distribution)
{
    std::lock_guard guard(_lock);
    _distribution = std::move(distribution);
}

std::shared_ptr<const lib::Distribution>
ContentBucketSpace::getDistribution() const
{
    std::lock_guard guard(_lock);
    return _distribution;
}

bool
ContentBucketSpace::getNodeUpInLastNodeStateSeenByProvider() const
{
    std::lock_guard guard(_lock);
    return _nodeUpInLastNodeStateSeenByProvider;
}

void
ContentBucketSpace::setNodeUpInLastNodeStateSeenByProvider(bool nodeUpInLastNodeStateSeenByProvider)
{
    std::lock_guard guard(_lock);
    _nodeUpInLastNodeStateSeenByProvider = nodeUpInLastNodeStateSeenByProvider;
}

bool
ContentBucketSpace::getNodeMaintenanceInLastNodeStateSeenByProvider() const
{
    std::lock_guard guard(_lock);
    return _nodeMaintenanceInLastNodeStateSeenByProvider;
}

void
ContentBucketSpace::setNodeMaintenanceInLastNodeStateSeenByProvider(bool nodeMaintenanceInLastNodeStateSeenByProvider)
{
    std::lock_guard guard(_lock);
    _nodeMaintenanceInLastNodeStateSeenByProvider = nodeMaintenanceInLastNodeStateSeenByProvider;
}

}