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

Source from the content-addressed store, hash-verified

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