namespace vase.

This commit is contained in:
2026-08-06 20:36:14 +01:00
parent 0720a254a3
commit 04a27b30aa
18 changed files with 39 additions and 11 deletions
+2
View File
@@ -4,6 +4,7 @@
#include "buffer.h"
#include "pch.h"
namespace crib::internal::vase {
struct AppendBuffer : Buffer {
char *buf = nullptr;
uint64_t allocated_capacity = 0;
@@ -21,3 +22,4 @@ struct AppendBuffer : Buffer {
private:
void grow(uint64_t len);
};
} // namespace crib::internal::vase
+2
View File
@@ -2,8 +2,10 @@
#include "pch.h"
namespace crib::internal::vase {
struct Buffer {
virtual const char *read(uint64_t pos) = 0;
virtual uint64_t length() = 0;
virtual ~Buffer() = default;
};
} // namespace crib::internal::vase
+2
View File
@@ -3,6 +3,7 @@
#include "buffer.h"
#include "pch.h"
namespace crib::internal::vase {
struct OriginalBuffer : Buffer {
const char *buf;
uint64_t len;
@@ -15,3 +16,4 @@ struct OriginalBuffer : Buffer {
const char *read(uint64_t pos) override;
uint64_t length() override;
};
} // namespace crib::internal::vase
+2
View File
@@ -2,4 +2,6 @@
#include "pch.h"
namespace crib::internal::vase {
constexpr uint64_t PETAL_SIZE_MAX = 32 * 1024;
}
+2
View File
@@ -3,7 +3,9 @@
#include "../shard.h"
#include "pch.h"
namespace crib::internal::vase {
enum struct Direction : uint8_t {
Forward,
Backward
};
}
+2
View File
@@ -4,6 +4,7 @@
#include "pch.h"
#include "petal.h"
namespace crib::internal::vase {
struct LineIterator {
PetalIterator it;
const char *chunk;
@@ -18,3 +19,4 @@ struct LineIterator {
bool next(std::string *line);
uint64_t byte_offset();
};
} // namespace crib::internal::vase
+2
View File
@@ -4,6 +4,7 @@
#include "iter.h"
#include "pch.h"
namespace crib::internal::vase {
struct PetalIterator {
Direction dir;
Shard *root = nullptr;
@@ -25,3 +26,4 @@ struct PetalIterator {
private:
Petal *_next(uint64_t *offset);
};
} // namespace crib::internal::vase
+2
View File
@@ -5,6 +5,7 @@
#include "constants.h"
#include "pch.h"
namespace crib::internal::vase {
struct Shard {
enum struct Kind : uint8_t {
Branch,
@@ -111,3 +112,4 @@ extern inline void dump_shard(Shard *node, int depth = 0) {
if (!depth)
std::cout << "\n\n";
}
} // namespace crib::internal::vase
+2 -1
View File
@@ -5,9 +5,9 @@
#include "constants.h"
#include "iterators/line.h"
#include "pch.h"
#include "search.h"
#include "shard.h"
namespace crib::internal::vase {
struct Point {
uint64_t row;
uint64_t col;
@@ -98,3 +98,4 @@ private:
std::string_view pattern, Range range, std::string_view options
);
};
} // namespace crib::internal::vase