aboutsummaryrefslogtreecommitdiffstats
path: root/prototypes/connections/module-save.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-25 16:06:21 +0100
committereunhhu <[email protected]>2026-09-25 16:06:21 +0100
commit517d5cf263bdbea232186636ce99e7c3be15d00f (patch)
treefe39aee427379bf75b91e70422039587086ea931 /prototypes/connections/module-save.h
parent18675f3e45fa0896efd777bf66ad0ec4c8157d36 (diff)
downloadpure-517d5cf263bdbea232186636ce99e7c3be15d00f.tar.gz
pure-517d5cf263bdbea232186636ce99e7c3be15d00f.zip
Save app changes in bursts
A save now publishes everything since the last save in one commit: the documents messages edited and the states that changed. If it fails, every event since the last save is undone (values, text and list drafts, the list undo log, event and tick counts), so an event reported as successful is stored and a failed one leaves no trace. By default each key, text and message event saves before it returns, as before. With pure_app_defer events apply at once and a host saves a burst with one commit; a key's document joins a burst once, so revisions move one per save. On the Pi's SD card 600 events take 6.3 s saved one by one, 0.97 s in bursts of 8 and 0.34 s in bursts of 64. pure-run takes --batch N. Tests compare a deferred stored app that saves at random and sometimes stops unsaved with an app that replays only the saved events, undo a whole burst on a failed save, and kill a process while it saves a burst.
Diffstat (limited to 'prototypes/connections/module-save.h')
-rw-r--r--prototypes/connections/module-save.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/prototypes/connections/module-save.h b/prototypes/connections/module-save.h
index 90e0701..b6db997 100644
--- a/prototypes/connections/module-save.h
+++ b/prototypes/connections/module-save.h
@@ -19,9 +19,10 @@ PureResult pure_save_open_list(PureApp *, const PureModule *m, uint32_t state, P
PureResult pure_save_open_values(PureApp *, const PureModule *m, double *values, bool load);
/* Store a list whose record changed in its draft, header and items anew. */
PureResult pure_save_rewrite_list(const PureModule *m, uint32_t state, PureList *list, PureDraft *draft);
-/* Publish every state changed since the last save (values are the pending
- * numbers), with document when not NULL; revision is the document's. */
-PureResult pure_save_commit(PureApp *, const double *values, void *document, int64_t *revision);
+/* Publish the documents and every state changed since the last save
+ * (values are the states' numbers); revisions are the documents'. */
+PureResult pure_save_commit(PureApp *, const double *values, void *const *documents, size_t document_count,
+ int64_t *revisions);
/* A list with record's fields, taking from `from` each field of the same name
* and kind and giving the others their defaults (module.c). */