Files
bed/include/vase/iterators/chunk.h
T
syedm 0bfa9300db 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.
2026-08-04 07:48:26 +01:00

31 lines
588 B
C++

#pragma once
#include "../shard.h"
#include "pch.h"
enum struct Direction : uint8_t {
Forward,
Backward
};
struct ChunkIterator {
Direction dir;
Shard *root = nullptr;
std::vector<Shard *> stack;
Petal *petal = nullptr;
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(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();
};