mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-23 06:19:33 +08:00
Complete C implementation of the indexing pipeline (src/), parallel worker pool, graph buffer with merge support, SQLite writer, and 1893-test suite. Linter setup: zero warnings from clang-tidy (all checks enabled, no NOLINT suppressions), cppcheck, and clang-format. All issues fixed at source — proper headers for external linkage, GROW_ARRAY macro restructured to eliminate type parameter, null-deref paths guarded, named intermediates for suspicious-argument checks.
53 lines
1.6 KiB
C
53 lines
1.6 KiB
C
#ifndef CBM_AC_H
|
|
#define CBM_AC_H
|
|
|
|
#include <stdint.h>
|
|
|
|
// Forward declaration — full struct in ac.c
|
|
typedef struct CBMAutomaton CBMAutomaton;
|
|
|
|
// Input for batch LZ4 scanning.
|
|
typedef struct {
|
|
const char *data;
|
|
int compressed_len;
|
|
int original_len;
|
|
} CBMLz4Entry;
|
|
|
|
// Output for batch LZ4 scanning.
|
|
typedef struct {
|
|
int file_index;
|
|
uint64_t bitmask;
|
|
} CBMLz4Match;
|
|
|
|
// Output for batch name scanning.
|
|
typedef struct {
|
|
int name_index;
|
|
int pattern_id;
|
|
} CBMMatchResult;
|
|
|
|
// Build an Aho-Corasick automaton from patterns.
|
|
CBMAutomaton *cbm_ac_build(const char **patterns, const int *lengths, int count,
|
|
const uint8_t *alpha_map, int alpha_size);
|
|
void cbm_ac_free(CBMAutomaton *ac);
|
|
|
|
// Single-text scanning (returns bitmask of matched pattern IDs).
|
|
uint64_t cbm_ac_scan_bitmask(const CBMAutomaton *ac, const char *text, int text_len);
|
|
|
|
// LZ4-compressed scanning.
|
|
uint64_t cbm_ac_scan_lz4_bitmask(const CBMAutomaton *ac, const char *compressed, int compressed_len,
|
|
int original_len);
|
|
int cbm_ac_scan_lz4_batch(const CBMAutomaton *ac, const CBMLz4Entry *entries, int num_entries,
|
|
CBMLz4Match *out_matches, int max_matches);
|
|
|
|
// Batch name scanning.
|
|
int cbm_ac_scan_batch(const CBMAutomaton *ac, const char *names_buf, const int *name_offsets,
|
|
const int *name_lengths, int num_names, CBMMatchResult *out_matches,
|
|
int max_matches);
|
|
|
|
// Introspection.
|
|
int cbm_ac_num_states(const CBMAutomaton *ac);
|
|
int cbm_ac_num_patterns(const CBMAutomaton *ac);
|
|
int cbm_ac_table_bytes(const CBMAutomaton *ac);
|
|
|
|
#endif // CBM_AC_H
|