MCPcopy
hub / github.com/witheve/Eve / commit

Method commit

src/runtime/changes.ts:174–219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172 }
173
174 commit() {
175 let final = this.finalChanges;
176 let changes = this.changes[this.round];
177 let {info, positions} = changes;
178 let keys = Object.keys(positions);
179 let multiIndex = this.index;
180 let committed = [];
181 let committedIx = 0;
182 for(let key of keys) {
183 let pos = positions[key];
184 let mult = info[pos];
185 if(mult === ChangeType.ADDED_REMOVED) {
186 continue;
187 }
188 let e = info[pos + 1];
189 let a = info[pos + 2];
190 let v = info[pos + 3];
191 let node = info[pos + 4];
192 let scope = info[pos + 5];
193 let curIndex = multiIndex.getIndex(scope);
194 if(mult === ChangeType.REMOVED && curIndex.lookup(e,a,v,node) !== undefined) {
195 this.changed = true;
196 curIndex.unstore(e,a,v,node);
197 final.dec(scope,e,a,v,node,key);
198 committed[committedIx] = ChangeType.REMOVED;
199 committed[committedIx+1] = e;
200 committed[committedIx+2] = a;
201 committed[committedIx+3] = v;
202 committed[committedIx+4] = node;
203 committed[committedIx+5] = scope;
204 committedIx += 6;
205 } else if(mult === ChangeType.ADDED && curIndex.lookup(e,a,v,node) === undefined) {
206 this.changed = true;
207 curIndex.store(e,a,v,node);
208 final.inc(scope,e,a,v,node,key);
209 committed[committedIx] = ChangeType.ADDED;
210 committed[committedIx+1] = e;
211 committed[committedIx+2] = a;
212 committed[committedIx+3] = v;
213 committed[committedIx+4] = node;
214 committed[committedIx+5] = scope;
215 committedIx += 6;
216 }
217 }
218 return committed;
219 }
220
221 nextRound() {
222 this.round++;

Callers 5

convertFunction · 0.45
analyzeFunction · 0.45
handleEventFunction · 0.45
executeActionsMethod · 0.45
fixpointMethod · 0.45

Calls 6

getIndexMethod · 0.80
decMethod · 0.80
incMethod · 0.80
lookupMethod · 0.45
unstoreMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected