blob: 671f604e4a212a55b84cb36ee735b2e488038d54 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <deque>
#include <memory>
#include <vector>
namespace search::memoryindex {
class DocumentInverter;
class DocumentInverterContext;
/*
* Class containing the document inverters used by a memory index.
*/
class DocumentInverterCollection {
DocumentInverterContext& _context;
std::vector<std::unique_ptr<DocumentInverter>> _free_inverters;
std::deque<std::unique_ptr<DocumentInverter>> _inflight_inverters;
std::unique_ptr<DocumentInverter> _active_inverter;
uint32_t _num_inverters;
uint32_t _max_inverters;
public:
DocumentInverterCollection(DocumentInverterContext& context, uint32_t max_inverters);
~DocumentInverterCollection();
DocumentInverter& get_active_inverter() noexcept { return *_active_inverter; }
void switch_active_inverter();
uint32_t get_num_inverters() const noexcept { return _num_inverters; }
uint32_t get_max_inverters() const noexcept { return _max_inverters; }
};
}
|