MCPcopy
hub / github.com/tinyplex/tinybase / updateStore

Function updateStore

src/checkpoints/index.ts:70–99  ·  view source on GitHub ↗
(oldOrNew: 0 | 1, checkpointId: Id)

Source from the content-addressed store, hash-verified

68 const forwardIds: Ids = [];
69
70 const updateStore = (oldOrNew: 0 | 1, checkpointId: Id) => {
71 listening = 0;
72 store.transaction(() => {
73 const [cellsDelta, valuesDelta] = mapGet(deltas, checkpointId) as [
74 CellsDelta,
75 ValuesDelta,
76 ];
77 collForEach(cellsDelta, (table, tableId) =>
78 collForEach(table, (row, rowId) =>
79 collForEach(row, (oldNew, cellId) =>
80 (store as ProtectedStore)._[5](
81 tableId,
82 rowId,
83 cellId,
84 oldNew[oldOrNew] as CellOrUndefined,
85 true,
86 ),
87 ),
88 ),
89 );
90 collForEach(valuesDelta, (oldNew, valueId) =>
91 (store as ProtectedStore)._[6](
92 valueId,
93 oldNew[oldOrNew] as ValueOrUndefined,
94 true,
95 ),
96 );
97 });
98 listening = 1;
99 };
100
101 const clearCheckpointId = (checkpointId: Id): void => {
102 mapSet(deltas, checkpointId);

Callers 2

goBackwardImplFunction · 0.70
goForwardImplFunction · 0.70

Calls 3

mapGetFunction · 0.90
collForEachFunction · 0.90
transactionMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…