aboutsummaryrefslogtreecommitdiffstats
path: root/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h
blob: 2332c05b57fe6005758dec076c6174e0f2235e83 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "persistenceprovider.h"

namespace storage::spi {

/**
 * Simplified abstract persistence provider class. Implements
 * some of the less used functions. Implementors are still encouraged
 * to review the full PersistenceProvider class to verify that
 * their desired behaviour is implemented.
 */
class AbstractPersistenceProvider : public PersistenceProvider
{
public:
    /**
     * Default impl is empty.
     */
    Result initialize() override { return Result(); };

    /**
     * Default impl empty.
     */
    Result createBucket(const Bucket&, Context&) override { return Result(); }

    /**
     * Default impl is empty.
     */
    Result removeEntry(const Bucket&, Timestamp, Context&) override { return Result(); }

    /**
     * Default impl is remove().
     */
    RemoveResult removeIfFound(const Bucket&, Timestamp, const DocumentId&, Context&) override;
    void removeIfFoundAsync(const Bucket&, Timestamp, const DocumentId&, Context&, OperationComplete::UP) override;

    /**
     * Default impl empty.
     */
    Result setClusterState(BucketSpace, const ClusterState&) override { return Result(); }

    /**
     * Default impl empty.
     */
    Result setActiveState(const Bucket&, BucketInfo::ActiveState) override { return Result(); } 
    /**
     * Default impl empty.
     */
    BucketIdListResult getModifiedBuckets(BucketSpace bucketSpace) const override;
};

}