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

Function cbm_gbuf_new

src/graph_buffer/graph_buffer.c:611–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609/* ── Lifecycle ──────────────────────────────────────────────────── */
610
611cbm_gbuf_t *cbm_gbuf_new(const char *project, const char *root_path) {
612 cbm_gbuf_t *gb = cbm_calloc(CBM_MEM_CLASS_OTHER, sizeof(cbm_gbuf_t));
613 if (!gb) {
614 return NULL;
615 }
616
617 gb->project = cbm_mem_strdup(CBM_MEM_CLASS_GBUF_STRING, project ? project : "");
618 gb->root_path = cbm_mem_strdup(CBM_MEM_CLASS_GBUF_STRING, root_path ? root_path : "");
619 gb->next_id = SKIP_ONE;
620 gb->shared_ids = NULL;
621
622 gb->node_by_qn = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
623 gb->by_id = NULL;
624 gb->by_id_cap = 0;
625 gb->nodes_by_label = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_32);
626 gb->nodes_by_name = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
627
628 gb->edges_by_source_type = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
629 gb->edges_by_target_type = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_256);
630 gb->edges_by_type = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, CBM_SZ_32);
631
632 gb->intern_pool = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_STRING, CBM_SZ_1K);
633
634 return gb;
635}
636
637cbm_gbuf_t *cbm_gbuf_new_shared_ids(const char *project, const char *root_path,
638 _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
pc_collect_spill_witnessFunction · 0.85
test_pipeline.cFile · 0.85

Calls 3

cbm_callocFunction · 0.85
cbm_mem_strdupFunction · 0.85
cbm_ht_create_inFunction · 0.85