-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathindex_source.cpp
More file actions
30 lines (24 loc) · 912 Bytes
/
index_source.cpp
File metadata and controls
30 lines (24 loc) · 912 Bytes
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
#include "index_source.h"
void Trinity::IndexSourcesCollection::commit() {
std::sort(sources.begin(), sources.end(), [](const auto a, const auto b) noexcept {
return b->generation() < a->generation();
});
map.clear();
all.clear();
for (auto s : sources) {
auto ud = s->masked_documents();
map.push_back({s, all.size()});
if (ud)
all.push_back(ud);
}
}
Trinity::IndexSourcesCollection::~IndexSourcesCollection() {
while (sources.size()) {
sources.back()->Release();
sources.pop_back();
}
}
std::unique_ptr<Trinity::masked_documents_registry> Trinity::IndexSourcesCollection::scanner_registry_for(const uint16_t idx) {
const auto n = map[idx].second;
return masked_documents_registry::make(all.data(), n);
}