MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / constructor

Method constructor

src/db/wal-valve.ts:108–123  ·  view source on GitHub ↗
(
    private readonly db: DatabaseConnection,
    softMb: number = resolveWalValveMb(process.env.CODEGRAPH_WAL_VALVE_MB),
    private readonly intervalMs: number = CHECK_INTERVAL_MS,
    log: (msg: string) => void = () => {}
  )

Source from the content-addressed store, hash-verified

106 private futileUntil = 0;
107
108 constructor(
109 private readonly db: DatabaseConnection,
110 softMb: number = resolveWalValveMb(process.env.CODEGRAPH_WAL_VALVE_MB),
111 private readonly intervalMs: number = CHECK_INTERVAL_MS,
112 log: (msg: string) => void = () => {}
113 ) {
114 this.softBytes = softMb * 1024 * 1024;
115 this.hardBytes = this.softBytes * HARD_CAP_MULTIPLIER;
116 this.fileCapBytes = this.softBytes * FILE_CAP_MULTIPLIER;
117 // CODEGRAPH_WAL_VALVE_DEBUG=1 surfaces valve decisions to stderr without
118 // needing the caller's verbose plumbing — the observability gap that let
119 // §7a.1 run 1 fail silently (give-ups were verbose-gated and invisible).
120 this.log = process.env.CODEGRAPH_WAL_VALVE_DEBUG
121 ? (m) => console.error(`[wal-valve] ${m}`)
122 : log;
123 }
124
125 private readonly log: (msg: string) => void;
126

Callers

nothing calls this directly

Calls 2

resolveWalValveMbFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected