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

Function cbm_service_pattern_match

internal/cbm/service_patterns.c:785–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783}
784
785cbm_svc_kind_t cbm_service_pattern_match(const char *resolved_qn) {
786 if (!resolved_qn || !resolved_qn[0]) {
787 return CBM_SVC_NONE;
788 }
789
790 if (_svc_cache) {
791 void *cached = cbm_ht_get(_svc_cache, resolved_qn);
792 if (cached) {
793 return svc_ptr_to_enum(cached);
794 }
795 }
796
797 cbm_svc_kind_t result = CBM_SVC_NONE;
798 const lib_pattern_t *p;
799
800 /* Route registration checked first — prevents gin/echo from matching
801 * as HTTP clients (both have .get/.post suffixes). */
802 if ((p = match_qn(resolved_qn, route_reg_libraries)))
803 result = p->kind;
804 else if ((p = match_qn(resolved_qn, http_libraries)))
805 result = p->kind;
806 else if ((p = match_qn(resolved_qn, async_libraries)))
807 result = p->kind;
808 else if ((p = match_qn(resolved_qn, config_libraries)))
809 result = p->kind;
810 else if ((p = match_qn(resolved_qn, grpc_libraries)))
811 result = p->kind;
812 else if ((p = match_qn(resolved_qn, graphql_libraries)))
813 result = p->kind;
814 else if ((p = match_qn(resolved_qn, trpc_libraries)))
815 result = p->kind;
816
817 if (_svc_cache) {
818 char *kdup = strdup(resolved_qn);
819 if (kdup)
820 cbm_ht_set(_svc_cache, kdup, svc_enum_to_ptr(result));
821 }
822 return result;
823}
824
825const char *cbm_service_pattern_http_method(const char *callee_name) {
826 if (!callee_name) {

Callers 4

emit_classified_edgeFunction · 0.85
resolve_single_callFunction · 0.85
emit_service_edgeFunction · 0.85
resolve_file_callsFunction · 0.85

Calls 5

cbm_ht_getFunction · 0.85
svc_ptr_to_enumFunction · 0.85
match_qnFunction · 0.85
cbm_ht_setFunction · 0.85
svc_enum_to_ptrFunction · 0.85

Tested by

no test coverage detected