blob: c7ef416a1feeca6537c20110fcbfc6e55aa532be (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "entryref.h"
#include "entry_ref_filter.h"
#include <vector>
#include <vespa/vespalib/stllike/allocator.h>
namespace vespalib::datastore {
/**
* Remapper for related UniqueStore class, used for adjusting
* references to unique store after compaction.
*/
template <typename RefT>
class UniqueStoreRemapper {
public:
using RefType = RefT;
protected:
EntryRefFilter _filter;
std::vector<std::vector<EntryRef, allocator_large<EntryRef>>> _mapping;
public:
UniqueStoreRemapper(EntryRefFilter&& filter);
virtual ~UniqueStoreRemapper();
EntryRef remap(EntryRef ref) const;
void remap(vespalib::ArrayRef<AtomicEntryRef> refs) const;
const EntryRefFilter& get_entry_ref_filter() const noexcept { return _filter; }
virtual void done() = 0;
};
}
|