Files
codebase-memory-mcp/internal/cbm/zstd_store.h
T
test 8babe67bea feat: add persistent artifact storage for team sharing
Add .codebase-memory/graph.db.zst — a zstd-compressed knowledge graph
artifact that can be committed to the repo. Teammates bootstrap from
the artifact instead of running a full reindex from scratch.

- Vendor zstd 1.5.7 (amalgamated build) for 8-13:1 compression
- Two-tier export: zstd -9 + index stripping for explicit index,
  zstd -3 for watcher/incremental auto-updates
- Import: decompress → integrity check → auto-recreate indexes
- Bootstrap in handle_index_repository: when no local DB exists but
  artifact is present, import first then run incremental
- Auto-create .gitattributes with merge=ours to prevent conflicts
- Fix: add missing idx_edges_url_path to create_user_indexes and
  url_path_gen generated column to init_schema
- 13 new tests (5 zstd wrapper + 8 artifact round-trip/edge cases)
2026-04-15 23:56:03 +02:00

18 lines
554 B
C

#ifndef CBM_ZSTD_STORE_H
#define CBM_ZSTD_STORE_H
#include <stddef.h>
// Zstd compression at specified level (1=fast .. 22=best).
// Returns compressed size on success, 0 on error.
int cbm_zstd_compress(const char *src, int srcLen, char *dst, int dstCap, int level);
// Zstd decompression.
// Returns decompressed size on success, 0 on error.
int cbm_zstd_decompress(const char *src, int srcLen, char *dst, int dstCap);
// Maximum compressed size bound for given input size.
size_t cbm_zstd_compress_bound(int inputSize);
#endif // CBM_ZSTD_STORE_H