MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / init

Method init

server/src/server/disk_prefix_cache.cpp:194–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192static void write_u64(FILE * f, uint64_t v) { std::fwrite(&v, 8, 1, f); }
193static void write_i64(FILE * f, int64_t v) { std::fwrite(&v, 8, 1, f); }
194static void write_u16(FILE * f, uint16_t v) { std::fwrite(&v, 2, 1, f); }
195
196static bool read_u32(FILE * f, uint32_t & out) { return std::fread(&out, 4, 1, f) == 1; }
197static bool read_u64(FILE * f, uint64_t & out) { return std::fread(&out, 8, 1, f) == 1; }
198static bool read_i64(FILE * f, int64_t & out) { return std::fread(&out, 8, 1, f) == 1; }
199static bool read_u16(FILE * f, uint16_t & out) { return std::fread(&out, 2, 1, f) == 1; }
200
201// ─── Construction ───────────────────────────────────────────────────────
202
203DiskPrefixCache::DiskPrefixCache(const DiskCacheConfig & cfg, ModelBackend & backend)
204 : config_(cfg), backend_(backend) {}
205
206// ─── Initialization ─────────────────────────────────────────────────────
207
208bool DiskPrefixCache::init() {
209 if (disabled()) return true;
210
211 if (!mkdir_p(config_.cache_dir)) {
212 std::fprintf(stderr, "[disk-cache] failed to create dir: %s\n",
213 config_.cache_dir.c_str());
214 return false;

Callers 1

HttpServerMethod · 0.45

Calls 3

mkdir_pFunction · 0.85
hexFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected