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

Method write_header

server/src/server/disk_prefix_cache.cpp:790–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788 // does NOT own the backend, so we cannot free it here. Since snapshot_free
789 // only frees buf + ctx, we accept a small leak of the lightweight cpu
790 // backend object (~64 bytes per load). For a bounded disk cache this is
791 // negligible. A proper fix would store cpu alongside the snapshot.
792
793 return true;
794}
795
796// ─── Header I/O ─────────────────────────────────────────────────────────
797
798bool DiskPrefixCache::write_header(FILE * f, const DiskCacheHeader & hdr) {
799 std::fwrite(hdr.magic, 1, 4, f);
800 write_u32(f, hdr.version);
801 std::fwrite(hdr.layout_id, 1, 16, f);
802 write_u32(f, hdr.cur_pos);
803 write_u32(f, hdr.n_tensors);
804 write_u32(f, hdr.token_count);
805 std::fwrite(hdr.token_hash, 1, 16, f);
806 write_u64(f, hdr.payload_bytes);
807 write_u64(f, hdr.created_at);

Callers

nothing calls this directly

Calls 2

write_u32Function · 0.85
write_u64Function · 0.85

Tested by

no test coverage detected