Perfect
- Make original buffer use a disk backed mapping to save memory. - rearrange api function headers for search etc. - fix bugs with iterators. - support uint64_t for all byte and line offsets to allow for much larger files to be opened. - and more minor bug fixes.
This commit is contained in:
@@ -13,15 +13,18 @@ struct ChunkIterator {
|
||||
Shard *root = nullptr;
|
||||
std::vector<Shard *> stack;
|
||||
Petal *petal = nullptr;
|
||||
uint32_t petal_offset = 0;
|
||||
uint32_t global_offset = 0;
|
||||
uint64_t petal_offset = 0;
|
||||
uint64_t global_offset = 0;
|
||||
uint64_t global_line = 0;
|
||||
bool at_end = false;
|
||||
|
||||
ChunkIterator(Shard *r, Direction dir);
|
||||
|
||||
~ChunkIterator();
|
||||
|
||||
void seek_offset(uint32_t offset);
|
||||
void seek_line(uint32_t offset);
|
||||
bool next(const char **data, uint32_t *out_len);
|
||||
uint32_t byte_offset();
|
||||
void seek_offset(uint64_t offset);
|
||||
void seek_line(uint64_t offset);
|
||||
bool next(const char **data, uint64_t *out_len);
|
||||
uint64_t byte_offset();
|
||||
uint64_t line_offset();
|
||||
};
|
||||
|
||||
@@ -9,11 +9,14 @@ struct LineIterator {
|
||||
Direction dir;
|
||||
|
||||
const char *chunk;
|
||||
uint32_t len;
|
||||
uint64_t len;
|
||||
uint64_t offset = 0;
|
||||
uint64_t chunk_offset = 0;
|
||||
bool at_end = false;
|
||||
|
||||
LineIterator(Shard *r, uint32_t start_line, Direction dir);
|
||||
LineIterator(Shard *r, uint64_t start_line, Direction dir);
|
||||
~LineIterator() = default;
|
||||
|
||||
bool next(std::string &line);
|
||||
uint32_t byte_offset();
|
||||
uint64_t byte_offset();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user