aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/documentmetastore/i_bucket_handler.h
blob: a633092e05967205b9e25109e4906079536383b9 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/document/bucket/bucketid.h>
#include <vespa/searchcore/proton/bucketdb/bucketdeltapair.h>
#include <vector>

namespace proton::bucketdb {
    class SplitBucketSession;
    class JoinBucketsSession;
    class BucketDBOwner;
}

namespace proton::documentmetastore {

/**
 * Interface for handling bucket changes relevant to the document meta store.
 */
struct IBucketHandler
{
    using BucketId = document::BucketId;

    virtual ~IBucketHandler() = default;

    virtual bucketdb::BucketDBOwner &getBucketDB() const = 0;

    /**
     * Split the source bucket into two target buckets.
     */
    virtual bucketdb::BucketDeltaPair
    handleSplit(const bucketdb::SplitBucketSession &session) = 0;

    /**
     * Join the two source buckets into a target bucket.
     */
    virtual bucketdb::BucketDeltaPair
    handleJoin(const bucketdb::JoinBucketsSession &session) = 0;

    /*
     * Adjust active flag on all lids belonging to given bucket
     */
    virtual void updateActiveLids(const BucketId &bucketId, bool active) = 0;

    /**
     * Sets the bucket state to active / inactive.
     * Documents that are inactive will not be white-listed during search.
     **/
    virtual void setBucketState(const BucketId &bucketId, bool active) = 0;

    /**
     * Sets the bucket state to active, used when adding document db as
     * part of live reconfig.
     **/
    virtual void populateActiveBuckets(BucketId::List buckets) = 0;

};

}