aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/bucketdb/bucketsessionbase.h
blob: b2fb07c2e6826b469c71a1a69207aa0f6c224722 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "bucket_db_owner.h"

namespace proton::bucketdb {

class IBucketCreateNotifier;

/**
 * Base class for split/join handling utility classes that bundles temporary
 * variables used during the operation.
 */
class BucketSessionBase
{
public:
    using GlobalId = document::GlobalId;
    using BucketId = document::BucketId;
    using Timestamp = storage::spi::Timestamp;

protected:
    Guard _bucketDB;
    IBucketCreateNotifier &_bucketCreateNotifier;

public:
    BucketSessionBase(BucketDBOwner &bucketDB, IBucketCreateNotifier &bucketCreateNotifier);
    BucketSessionBase(const BucketSessionBase &) = delete;
    BucketSessionBase & operator =(const BucketSessionBase &) = delete;
    ~BucketSessionBase();
    bool extractInfo(const BucketId &bucket, BucketState *&info);

    static bool calcFixupNeed(BucketState *state, bool wantActive, bool fixup);
};

}