MCPcopy
hub / github.com/Doorman11991/smallcode / MemoryBackend

Class MemoryBackend

src/compiled/cognition/traces.js:53–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 return redactValue(value, entityHint);
52}
53class MemoryBackend {
54 buffer = [];
55 cap = 10_000;
56 async write(span) {
57 this.buffer.push(span);
58 if (this.buffer.length > this.cap) {
59 this.buffer.splice(0, this.buffer.length - this.cap);
60 }
61 }
62 async loadTrace(trace_id) {
63 return this.buffer.filter(s => s.trace_id === trace_id).sort((a, b) => a.started_at - b.started_at);
64 }
65 __reset() { this.buffer = []; }
66}
67class PgBackend {
68 async write(span) {
69 // Lazy import — keeps tests that don't exercise PG free of pg.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected