aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/docstore/liddatastore.h
blob: e431f33af0531680760188d3fe8c620fd9f791cf (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "idatastore.h"

namespace search {

/**
 * Factor out stuff common to MultiDataStore and SimpleDatastore
 **/
class LidDataStore : public IDataStore
{
public:
    /**
     * Construct an idata store.
     * A data store has a base directory. The rest is up to the implementation.
     *
     * @param dirName  The directory that will contain the data file.
     **/
    LidDataStore(const vespalib::string & dirName) : IDataStore(dirName), _lastSyncToken(0) { }


    /**
     * The sync token used for the last successful flush() operation,
     * or 0 if no flush() has been performed yet.
     * @return Last flushed sync token.
     **/
    virtual uint64_t lastSyncToken() const { return _lastSyncToken; }

    virtual size_t getDiskBloat() const { return 0; }

    /**
     * Flush all in-memory data to disk.
     **/
    virtual void flushAll(uint64_t syncToken) {
        flush(syncToken);
    }

    /**
     * Get the number of entries (including removed IDs
     * or gaps in the local ID sequence) in the data store.
     * @return The next local ID expected to be used
     */
//    uint64_t nextId() const { return _nextId; }


protected:
    void setLastSyncToken(uint64_t last) { _lastSyncToken = last; }
//    void setNextId(uint64_t id) { _nextId = id; }

private:
    uint64_t    _lastSyncToken;
//    uint64_t    _nextId;
};

} // namespace search