From e4bc782d09fe1c80098a38380b3959863dfe188f Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 05:39:47 +0100 Subject: Add a store handle that shares one mapping Opening a draft by path opened the directory and the file, mapped the whole file, read the head, and undid all of it on close: nine system calls for every GET. pure_store_open keeps the store open for one owner thread; drafts opened through it share a reference-counted mapping of the newest version, and opening one only checks whether the file changed (its identity and its head: two system calls). A commit of its drafts maps the new version once and moves them all onto it. A compaction by another writer is noticed and followed, while drafts of the old file keep reading it and relocate their extents when they commit. pure_store_data gives modules the same through a handle. --- prototypes/connections/module-store.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'prototypes/connections/module-store.h') diff --git a/prototypes/connections/module-store.h b/prototypes/connections/module-store.h index 0a4b494..d14ab3d 100644 --- a/prototypes/connections/module-store.h +++ b/prototypes/connections/module-store.h @@ -5,4 +5,7 @@ * one event opens the message key as a held draft and commits it together * with the states the event changed. The path outlives the app. */ PureData pure_tree_data(const char *path); +/* The same through a store handle (state.h): opening a document or state + * checks only whether the store changed. The handle outlives the app. */ +PureData pure_store_data(PureStore *); #endif -- cgit v1.2.3