aboutsummaryrefslogtreecommitdiffstats
path: root/prototypes/connections/module.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 21:54:49 +0100
committereunhhu <[email protected]>2026-09-26 21:54:49 +0100
commitd693cc750b75b2d862614b6f79f81a311f6294ca (patch)
tree71588161adc22f5791ce38becf1df650b92501da /prototypes/connections/module.c
parentcb23514a5a2b00f635444d0e98a429419e6a67b4 (diff)
downloadpure-d693cc750b75b2d862614b6f79f81a311f6294ca.tar.gz
pure-d693cc750b75b2d862614b6f79f81a311f6294ca.zip
Lend a text state's stored extents for its view (079)
A view that shows a text state as it is (pure_module_text_state) now goes out as the state's stored extents, as a document read does: the answer holds the store mapping, charged to the budget, until it is sent and its ticket released; a state with edits not yet stored is copied as before. Documents and views share one loan path, and the extent array grows as needed. A 1 MiB note read by 8 connections: 776-817 answers a second copied, 1,875-1,901 lent, p50 9.2 to 3.5 ms, peak RSS 10.3 to 5.7 MiB. The load generator learns GET /views/page.
Diffstat (limited to 'prototypes/connections/module.c')
-rw-r--r--prototypes/connections/module.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/prototypes/connections/module.c b/prototypes/connections/module.c
index 1b96ac1..e4c7309 100644
--- a/prototypes/connections/module.c
+++ b/prototypes/connections/module.c
@@ -662,6 +662,12 @@ int pure_module_position(const PureModule *m, uint32_t view) {
return block->length == 2 && code[0].op == PURE_OP_INDEX_LOAD && code[1].op == PURE_OP_INDEX_NUM ? (int)code[0].arg : -1;
}
+int pure_module_text_state(const PureModule *m, uint32_t view) {
+ if (view >= m->views || m->view_type[view] != PURE_VIEW_TEXT || m->view_table[view]) return -1;
+ const PureBlock *block = &m->view_code[view];
+ return block->length == 1 && m->code[block->start].op == PURE_OP_TEXT_LOAD ? (int)m->code[block->start].arg : -1;
+}
+
int pure_module_column(const PureModule *m, uint32_t table, const char *name) {
for (uint32_t i = 0; i < m->views; ++i)
if (m->view_table[i] == table + 1 && !strcmp(m->view_names[i], name)) return (int)i;