MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / gm_bounds

Function gm_bounds

src/store/graph_mem.c:215–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213/* ── Build ──────────────────────────────────────────────────────── */
214
215static bool gm_bounds(sqlite3 *db, int64_t *max_node, int64_t *max_edge) {
216 sqlite3_stmt *st = NULL;
217 if (sqlite3_prepare_v2(db, "SELECT (SELECT max(id) FROM nodes), (SELECT max(id) FROM edges);",
218 -1, &st, NULL) != SQLITE_OK) {
219 sqlite3_finalize(st);
220 return false;
221 }
222 bool ok = sqlite3_step(st) == SQLITE_ROW;
223 if (ok) {
224 *max_node = sqlite3_column_int64(st, 0);
225 *max_edge = sqlite3_column_int64(st, 1);
226 }
227 sqlite3_finalize(st);
228 return ok && *max_node >= 0 && *max_edge >= 0 && *max_node < GM_ID_LIMIT &&
229 *max_edge < GM_ID_LIMIT;
230}
231
232/* Upper bound of a layer's bytes: edge ids are unique positive rowids, so the
233 * edge count never exceeds max(edges.id). */

Callers 1

cbm_graph_mem_acquireFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected