diff options
| author | eunhhu <[email protected]> | 2026-09-28 19:08:09 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 19:08:09 +0100 |
| commit | ec210a8aed62c301e9ae384d4d157e379fa58f54 (patch) | |
| tree | 49ce69c1ffcdb50a9d9ccf9d6cb8fcbf46e34a5d /core/module-save.h | |
| parent | 745efcd4f19b59bcfb131df2d127a3387a544e84 (diff) | |
| download | pure-ec210a8aed62c301e9ae384d4d157e379fa58f54.tar.gz pure-ec210a8aed62c301e9ae384d4d157e379fa58f54.zip | |
Keep the numbers heard as a list: a save logs only the ones it changed
The last number heard from each source was written whole into the links
value at every save, and counted in two bytes: a node that heard from
more than 65,535 sources stored a wrong count, and each save cost as many
bytes as there were sources. The numbers are now a runtime-owned list
{source, seq} in order of source, stored as a list state is (its image
"0heard" and its changes in the log), changed with the event that
delivers, so a failed save takes them back with it. Links stored before
(PLK1) move their numbers to the list at a start and are stored again
without them (PLK2).
Diffstat (limited to 'core/module-save.h')
| -rw-r--r-- | core/module-save.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/core/module-save.h b/core/module-save.h index 819f948..32e68c7 100644 --- a/core/module-save.h +++ b/core/module-save.h @@ -24,16 +24,27 @@ PureResult pure_save_image(PureApp *, const PureModule *m, uint32_t state, const void pure_save_close_start(PureApp *); /* The log keeps only the entries some list's image does not hold yet. */ void pure_save_release(PureApp *); -/* A snapshot's list (module.c). */ +/* A snapshot's list (module.c): a state's, or the heard list's + * (PURE_LIST_HEARD) in a snapshot made with it (pure_save_snapshot). */ const PureList *pure_snapshot_list(const PureSnapshot *, uint32_t state); +PureSnapshot *pure_save_snapshot(PureApp *, bool heard); +/* The heard list of a starting app (module.h, PureApp): from its image with + * its logged changes made again, or new (saved.rewrite: it needs an image, + * which pure_save_heard_image writes). */ +PureResult pure_save_open_heard(PureApp *, PureList **out, PureSaved *saved); +PureResult pure_save_heard_image(PureApp *); +/* An empty heard list. */ +PureList *pure_heard_new(void); /* Open the stored numbers, cursors and indices, and put each stored one of the * same name and kind that still fits into values, for the states of m that * kept marks as new (-1); texts and lists are m's. */ PureResult pure_save_open_values(PureApp *, const PureModule *m, double *values, const int *kept, PureDraft *const *texts, PureList *const *lists); /* The stored links of a starting app (module.h, PureApp); CONFLICT when an - * output with sends left is missing or has other fields. */ -PureResult pure_save_open_links(PureApp *, const PureModule *m); + * output with sends left is missing or has other fields. Links stored before + * the heard list kept the numbers heard: they go to it (moved: it needs an + * image). */ +PureResult pure_save_open_links(PureApp *, const PureModule *m, bool *moved); /* 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, |
