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

Function emit_grpc_edge

src/pipeline/pass_parallel.c:1870–1904  ·  view source on GitHub ↗

Emit GRPC_CALLS edge via gRPC Route node. */

Source from the content-addressed store, hash-verified

1868
1869/* Emit GRPC_CALLS edge via gRPC Route node. */
1870static void emit_grpc_edge(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source, const CBMCall *call,
1871 const cbm_resolution_t *res) {
1872 char service[CBM_SZ_256];
1873 char method[CBM_SZ_256];
1874 /* Try callee_name first (e.g., "pb.NewCartServiceClient.GetCart") */
1875 if (!extract_grpc_service_method(call->callee_name, service, sizeof(service), method,
1876 sizeof(method))) {
1877 /* Fallback: try the resolved QN for Go chained calls.
1878 * Go pattern: pb.NewCartServiceClient(conn).GetCart(ctx, req)
1879 * callee_name = "GetCart", QN = "...CartServiceClient.GetCart"
1880 * The QN contains the full ServiceClient.Method pattern. */
1881 if (!res->qualified_name ||
1882 !extract_grpc_service_method(res->qualified_name, service, sizeof(service), method,
1883 sizeof(method))) {
1884 return;
1885 }
1886 }
1887
1888 char route_qn[CBM_SZ_512];
1889 snprintf(route_qn, sizeof(route_qn), "__grpc__%s/%s", service, method);
1890
1891 char route_name[CBM_SZ_256];
1892 snprintf(route_name, sizeof(route_name), "%s/%s", service, method);
1893
1894 int64_t route_id = cbm_gbuf_upsert_node(gbuf, "Route", route_name, route_qn, "", 0, 0,
1895 "{\"source\":\"grpc\"}");
1896
1897 char esc_c[CBM_SZ_256];
1898 cbm_json_escape(esc_c, sizeof(esc_c), call->callee_name);
1899 char props[CBM_SZ_1K];
1900 snprintf(props, sizeof(props),
1901 "{\"callee\":\"%s\",\"service\":\"%s\",\"method\":\"%s\",\"confidence\":%.2f}", esc_c,
1902 service, method, res->confidence);
1903 cbm_gbuf_insert_edge(gbuf, source->id, route_id, "GRPC_CALLS", props);
1904}
1905
1906/* Emit GRAPHQL_CALLS edge. Extract operation from first string arg if available. */
1907static void emit_graphql_edge(cbm_gbuf_t *gbuf, const cbm_gbuf_node_t *source, const CBMCall *call,

Callers 1

emit_service_edgeFunction · 0.85

Calls 4

cbm_gbuf_upsert_nodeFunction · 0.85
cbm_json_escapeFunction · 0.85
cbm_gbuf_insert_edgeFunction · 0.85

Tested by

no test coverage detected