blob: ab6bc2da21c256ebe0100b207b9589fe661360ef (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "pagedict4_encoders.h"
#include "threelevelcountbuffers.h"
namespace search::bitcompression {
class PageDict4SSWriter;
class PageDict4SPWriter;
class PageDict4PWriter;
}
namespace search::index { class PostingListCounts; }
namespace search::diskindex::test {
/*
* Class for writing to memory based pagedict4 structure
*/
class PageDict4MemWriter
{
public:
using PageDict4SSWriter = search::bitcompression::PageDict4SSWriter;
using PageDict4SPWriter = search::bitcompression::PageDict4SPWriter;
using PageDict4PWriter = search::bitcompression::PageDict4PWriter;
using PostingListCounts = search::index::PostingListCounts;
private:
PageDict4Encoders _encoders;
public:
ThreeLevelCountWriteBuffers _buffers;
private:
PageDict4SSWriter *_ssw;
PageDict4SPWriter *_spw;
PageDict4PWriter *_pw;
void allocWriters();
public:
PageDict4MemWriter(uint32_t chunkSize, uint64_t numWordIds, uint32_t ssPad, uint32_t spPad, uint32_t pPad);
~PageDict4MemWriter();
void flush();
void addCounts(const std::string &word, const PostingListCounts &counts);
void startPad(uint32_t ssHeaderLen, uint32_t spHeaderLen, uint32_t pHeaderLen)
{
_buffers.startPad(ssHeaderLen, spHeaderLen, pHeaderLen);
}
};
}
|