summaryrefslogtreecommitdiffstats
path: root/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h
blob: fe8028913a47316b61a091345dace2f01e01d601 (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
76
77
78
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/persistence/spi/persistenceprovider.h>

namespace storage {

namespace 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(); };

    /**
     * Updates the document by calling get(), updating the document,
     * then calling put() on the result.
     */
    UpdateResult update(const Bucket&, Timestamp, const DocumentUpdateSP&, Context&) override;

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

    /**
     * Default impl is empty.
     */
    Result maintain(const Bucket&, MaintenanceLevel) override { return Result(); }

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

    /**
     * Default impl is getBucketInfo();
     */
    Result flush(const Bucket&, Context&) override { return Result(); }

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

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

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

    /**
     * Uses join by default.
     */
    Result move(const Bucket& source, PartitionId id, Context&) override;
};

}

}