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

Method onFixpoint

src/runtime/databases/node/server.ts:79–109  ·  view source on GitHub ↗
(evaluation: Evaluation, changes: Changes)

Source from the content-addressed store, hash-verified

77 }
78
79 onFixpoint(evaluation: Evaluation, changes: Changes) {
80 let name = evaluation.databaseToName(this);
81 let result = changes.result({[name]: true});
82 let handled = {};
83 let index = this.index;
84 let actions = [];
85 for(let insert of result.insert) {
86 let [e,a,v] = insert;
87 if(!handled[e]) {
88 handled[e] = true;
89 if(index.lookup(e,"tag", "request") && !index.lookup(e, "tag", "sent")) {
90 let responses = index.asValues(e, "response");
91 if(responses || index.lookup(e, "tag", "handling")) this.handling = true;
92 if(responses === undefined) continue;
93 let [response] = responses;
94 let {status, body} = index.asObject(response);
95 actions.push(new InsertAction("server|sender", e, "tag", "sent", undefined, [name]));
96 this.sendResponse(evaluation, e, status[0], body[0]);
97 }
98 }
99 }
100 if(actions.length) {
101 process.nextTick(() => {
102 evaluation.executeActions(actions);
103 // because this database is created per http request, we need to destroy this
104 // evaluation once a response has been sent and we've dealt with any consequences
105 // of the send.
106 evaluation.close();
107 })
108 }
109 }
110}
111
112

Callers

nothing calls this directly

Calls 8

sendResponseMethod · 0.95
databaseToNameMethod · 0.80
resultMethod · 0.80
asValuesMethod · 0.80
executeActionsMethod · 0.80
lookupMethod · 0.45
asObjectMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected