diff options
| author | eunhhu <[email protected]> | 2026-09-25 09:33:43 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-25 09:33:43 +0100 |
| commit | 6a28879bd56354483fe940c0c80d511eccb89983 (patch) | |
| tree | ed919d234ea2dbe8099e53fae51e495d8bee984e /prototypes/connections/test-splice.c | |
| parent | 8a65fd032e6f74938caf84d6f6fcda6314e76a01 (diff) | |
| download | pure-6a28879bd56354483fe940c0c80d511eccb89983.tar.gz pure-6a28879bd56354483fe940c0c80d511eccb89983.zip | |
Add selected single-file persistent tree store
store-tree.c keeps every document in one append-only file as a persistent
B-tree of byte extents, with the key catalog in the same structure. A splice
writes only the changed leaf and path; unchanged extents are shared between
versions, readers take no lock, and two alternating head slots publish a
commit after its nodes are durable. Compaction rewrites reachable nodes.
On the recorded ext4 host a durable 1-byte middle insert into a 1 MiB
document took 8.58 ms against 78.51 ms for the default store, and the real
TUI's Ctrl+S after typing took 16.60 ms against 84.59 ms. check-tree runs the
store's crash/oracle tests and the unchanged runtime, splice, async and
real-PTY editor checks on it. It stays opt-in: linked code is 12.7 KB larger
and contiguous multi-leaf reads copy.
Diffstat (limited to 'prototypes/connections/test-splice.c')
| -rw-r--r-- | prototypes/connections/test-splice.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/prototypes/connections/test-splice.c b/prototypes/connections/test-splice.c index bf3c0a9..51970d3 100644 --- a/prototypes/connections/test-splice.c +++ b/prototypes/connections/test-splice.c @@ -126,12 +126,15 @@ static void storage(const char *path) { expect(path, "work", revision, (PureSpan){oracle, length}); CHECK(pure_store_splice(path, "work", revision, 0, length, (PureSpan){0}, PURE_OBJECT_LIMIT, &revision) == PURE_OK); expect(path, "work", revision, (PureSpan){0}); +#ifndef PURE_STORE_TREE + /* Per-object file formats; test-tree-store covers the same limit. */ char file[256]; snprintf(file, sizeof(file), "%s/obj-work", path); int fd = open(file, O_WRONLY); const unsigned char maximum[] = {255,255,255,255,255,255,255,127}; CHECK(fd >= 0 && pwrite(fd, maximum, 8, 8) == 8 && close(fd) == 0); CHECK(pure_store_splice(path, "work", INT64_MAX, 0, 0, (PureSpan){0}, PURE_OBJECT_LIMIT, &revision) == PURE_LIMIT); +#endif } static void runtime(const char *path) { |
