blob: 70b1b168d8916436913fba4846e1dc11d72ef951 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <cstdint>
#include <cstddef>
namespace search::common {
/**
* Interface for a component that has a lid space that can be compacted and shrunk.
*/
struct ICompactableLidSpace {
virtual ~ICompactableLidSpace() = default;
/**
* Compacts the lid space down to the wanted given doc id limit.
* After this, the remaining lid space is a candidate for shrinking (freeing of memory resources).
*/
virtual void compactLidSpace(uint32_t wantedDocLidLimit) = 0;
/**
* Returns whether this lid space can be shrunk down to the wanted doc id limit.
*/
virtual bool canShrinkLidSpace() const = 0;
/*
* Returns how much memory (in bytes) that can be saved by shrinking lid space.
*/
virtual size_t getEstimatedShrinkLidSpaceGain() const = 0;
/**
* Shrinks this lid space down to the wanted doc id limit (frees memory resources).
*/
virtual void shrinkLidSpace() = 0;
};
}
|