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:793–831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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