aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/datastore/compacting_buffers.h
blob: 87e698c4ecaa27d2f739a1c6599decbe739f1063 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <cstdint>
#include <vector>

namespace vespalib::datastore {

class DataStoreBase;
class EntryRefFilter;

/*
 * Class representing the buffers currently being compacted in a data store.
 */
class CompactingBuffers
{
    DataStoreBase&        _store;
    uint32_t              _num_buffers;
    uint32_t              _offset_bits;
    std::vector<uint32_t> _buffer_ids;
public:
    CompactingBuffers(DataStoreBase& store, uint32_t num_buffers, uint32_t offset_bits, std::vector<uint32_t> buffer_ids);
    ~CompactingBuffers();
    DataStoreBase& get_store() const noexcept { return _store; }
    const std::vector<uint32_t>& get_buffer_ids() const noexcept { return _buffer_ids; }
    bool empty() const noexcept { return _buffer_ids.empty(); }
    void finish();
    EntryRefFilter make_entry_ref_filter() const;
};

}