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

Function cbm_gbuf_new

src/graph_buffer/graph_buffer.c:605–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603/* ── Lifecycle ──────────────────────────────────────────────────── */
604
605cbm_gbuf_t *cbm_gbuf_new(const char *project, const char *root_path) {
606 cbm_gbuf_t *gb = cbm_calloc(CBM_MEM_CLASS_OTHER, sizeof(cbm_gbuf_t));
607 if (!gb) {
608 return NULL;
609 }
610
611 gb->project = cbm_mem_strdup(CBM_MEM_CLASS_GBUF_STRING, project ? project : "");
612 gb->root_path = cbm_mem_strdup(CBM_MEM_CLASS_GBUF_STRING, root_path ? root_path : "");
613 gb->next_id = SKIP_ONE;
614 gb->shared_ids = NULL;
615
616 gb->node_by_qn = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
617 gb->by_id = NULL;
618 gb->by_id_cap = 0;
619 gb->nodes_by_label = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_32);
620 gb->nodes_by_name = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
621
622 gb->edges_by_source_type = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
623 gb->edges_by_target_type = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
624 gb->edges_by_type = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_32);
625
626 gb->intern_pool = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_STRING, CBM_SZ_1K);
627
628 return gb;
629}
630
631cbm_gbuf_t *cbm_gbuf_new_shared_ids(const char *project, const char *root_path,
632 _Atomic int64_t *id_source) {

Callers 15

cbm_gbuf_new_shared_idsFunction · 0.85
closure_probe_surfacesFunction · 0.85
run_closure_deltaFunction · 0.85
cbm_pipeline_run_stagedFunction · 0.85
test_simhash.cFile · 0.85
test_mem.cFile · 0.85
test_pipeline.cFile · 0.85
test_configlink.cFile · 0.85
build_oversized_corpusFunction · 0.85
run_sequentialFunction · 0.85

Calls 3

cbm_callocFunction · 0.85
cbm_mem_strdupFunction · 0.85
cbm_ht_create_inFunction · 0.85