aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/operation_routing_snapshot.cpp
blob: 8410104a74d12ac656cd23fa0d5d94ab39ba9e28 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "operation_routing_snapshot.h"

namespace storage::distributor {

OperationRoutingSnapshot::OperationRoutingSnapshot(std::shared_ptr<const BucketSpaceDistributionContext> context,
                                                   std::shared_ptr<BucketDatabase::ReadGuard> read_guard,
                                                   const DistributorBucketSpaceRepo* bucket_space_repo)
    : _context(std::move(context)),
      _read_guard(std::move(read_guard)),
      _bucket_space_repo(bucket_space_repo)
{}

OperationRoutingSnapshot::~OperationRoutingSnapshot() = default;

OperationRoutingSnapshot OperationRoutingSnapshot::make_not_routable_in_state(
        std::shared_ptr<const BucketSpaceDistributionContext> context)
{
    return OperationRoutingSnapshot(std::move(context), std::shared_ptr<BucketDatabase::ReadGuard>(), nullptr);
}

OperationRoutingSnapshot OperationRoutingSnapshot::make_routable_with_guard(
        std::shared_ptr<const BucketSpaceDistributionContext> context,
        std::shared_ptr<BucketDatabase::ReadGuard> read_guard,
        const DistributorBucketSpaceRepo& bucket_space_repo)
{
    return OperationRoutingSnapshot(std::move(context), std::move(read_guard), &bucket_space_repo);
}

}