blob: a90bde7eafda3f4283ce4494d47f552028991a06 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "compact_buffer_candidate.h"
#include <vector>
namespace vespalib::datastore {
/*
* Class representing candidate buffers for compaction.
*/
class CompactBufferCandidates {
std::vector<CompactBufferCandidate> _candidates;
size_t _used;
size_t _dead;
uint32_t _max_buffers;
double _active_buffers_ratio;
double _ratio;
size_t _slack;
uint32_t _free_buffers;
public:
CompactBufferCandidates(uint32_t num_buffers, uint32_t max_buffers, double active_buffers_ratio, double ratio, size_t slack);
~CompactBufferCandidates();
void add(uint32_t buffer_id, size_t used, size_t dead);
void set_free_buffers(uint32_t free_buffers);
void select(std::vector<uint32_t>& buffers);
};
}
|