aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-save.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-18 19:30:16 +0100
committereunhhu <[email protected]>2026-10-18 19:30:16 +0100
commitb22b8c3f6c5378b47c36370225d7c41d4394bb7c (patch)
treed1a3cbf1b0e718f0acafa08ec6741761f08e5dd5 /core/module-save.c
parente8b3499289022c8729900a58ed218d961a85fec8 (diff)
downloadpure-b22b8c3f6c5378b47c36370225d7c41d4394bb7c.tar.gz
pure-b22b8c3f6c5378b47c36370225d7c41d4394bb7c.zip
Module format v7, 027's 4b-2: keyed documents gone, a keyed list of records holding bytes doing their work: no collections table, DOC, DOC_SIZE or REPLACE (106 opcodes now 103, those from LEN on moved up), keyed messages or a base revision (pure_app_message takes an input and a payload), no PureData document callbacks (a data host opens states and saves them together), no burst by document key; the header 38 bytes; pure-edit-module gone; pure-serve without /objects, ETag, If-Match and If-None-Match, 412 or an app a thread for a module of documents alone (one without states or outputs runs so); a hole closed: an instruction in no handler's, view's or function's block was never verified yet the load's later passes read its arguments (a damaged module read out of bounds once the header moved what the mutation test damaged), now blanked to CONST 0; checks moved: server_documents (DOCS_SOURCE, keyed byte documents with the app's revision, against a Python model, one and three connection threads, a restart) in place of the parity with editor.pure, pipelining and bursts through kill -9 on its inputs and views, the lent budget on a text view (lending a document's read is server_lent_views' already), clocks and tokens on it; message tests without a document host; the HTTP benchmark's document suite runs the earlier document server and the baselines alone; the count harness builds against either message API (runs.sh build: -DPURE_KEYED_MESSAGES before 4b); counts: b33 against b32 with batches within 0.002% but BFS -0.33%, without batches BFS +0.63%, knapsack +0.52%, join +0.38%; the bank's queries (s32 on a v6 module, s33 on v7) field +0.68%, found +0.44%, large +0.42%, the rest within 0.13%; 008 as v7, 027's 4b-2 as made and 4c designed
Diffstat (limited to 'core/module-save.c')
-rw-r--r--core/module-save.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/core/module-save.c b/core/module-save.c
index f87cd24..c70a181 100644
--- a/core/module-save.c
+++ b/core/module-save.c
@@ -15,8 +15,8 @@
* then its items (module-list.h). The log has an entry for each save that
* changed lists: per list changed, {u8 name length, the name, u32le length,
* the records of its changes (module-list.h) in its image's fields}. A save
- * with such an entry that also commits the tree (numbers, texts, links,
- * documents) stores its number there as the state "seq": the entry counts
+ * with such an entry that also commits the tree (numbers, texts, links)
+ * stores its number there as the state "seq": the entry counts
* only when the tree holds its number (or a later one), so both are kept or
* neither. A start
* reads each list's image and makes again the changes logged after the save
@@ -1059,15 +1059,8 @@ static unsigned char *list_changes(const PureApp *app, size_t *size) {
return payload;
}
-PureResult pure_save_commit(PureApp *app, const PureValue *values, void *const *documents, size_t document_count,
- int64_t *revisions) {
- if (!pure_save_enabled(app)) {
- /* Without a host that saves together, a save has one document at most. */
- PureResult result = PURE_OK;
- for (size_t i = 0; i < document_count && result == PURE_OK; ++i)
- result = app->data.commit(app->data.context, documents[i], &revisions[i]);
- return result;
- }
+PureResult pure_save_commit(PureApp *app, const PureValue *values) {
+ if (!pure_save_enabled(app)) return PURE_OK; /* the states live in memory alone */
/* A save that may or may not have been stored: until the app starts again
* from what the store has, no save follows it. */
if (app->uncertain) return PURE_CONFLICT;
@@ -1125,7 +1118,7 @@ PureResult pure_save_commit(PureApp *app, const PureValue *values, void *const *
size_t payload_size = 0;
unsigned char *payload = result == PURE_OK ? list_changes(app, &payload_size) : NULL;
if (payload_size && !payload) result = PURE_ALLOCATION;
- bool tree = count || document_count;
+ bool tree = count;
uint64_t seq = app->seq + 1;
if (result == PURE_OK && tree && payload_size && app->log) {
result = app->stored_seq ? PURE_OK : open_state(app, "", "seq", &app->stored_seq);
@@ -1146,7 +1139,7 @@ PureResult pure_save_commit(PureApp *app, const PureValue *values, void *const *
}
free(payload);
if (result == PURE_OK && tree) {
- result = app->data.save(app->data.context, documents, document_count, drafts, count, revisions);
+ result = app->data.save(app->data.context, drafts, count);
/* A commit that may yet be stored leaves the app apart from its store,
* whatever the save changed: no save follows until it starts again.
* One that failed takes back the logged entry, which is on the device. */