C# · Serialization

Serialization

3.0.0-rc.1 · 4c3e5023

Checkpoints ride the SafeGraphs interchange format, and the path extension picks the layout: a .safegraphs path is one monolith, a .safegraphs.json path is a manifest cataloging many. Checkpoints are residency-portable: one file materializes into RAM, uploads to the devices, or opens in place on disk, decided by the constructor that opens it.

await index.Deferred(pool).Save("index.safegraphs");                        // Or: index.On(pool).Save(path)

DenseMetadata metadata = DenseIndex.MetadataRead("index.safegraphs", pool);  // Geometry without loading

using DenseIndex restored = DenseIndex.LoadRam("index.safegraphs", executor: pool); // Checkpoint freezes the geometry
using DenseIndex served = DenseIndex.ViewRam("index.safegraphs");                    // Mapped in place, read-only

Monolith buffer = index.On(pool).SaveBuffer(arena);                         // Or one monolith in memory
using DenseIndex copied = DenseIndex.LoadRamBuffer(buffer.Bytes, executor: pool);

DenseMetadata carries the four fields a checkpoint froze: dimensions, metric, quantization and connectivity. Residency is absent because a checkpoint records where it was written rather than where a reader must keep it, and ValuesPerKey is absent because it bounds a live handle’s mutable state rather than the serialized form. A monolith reports its Length as a long, and one past 2 GiB refuses to lend its Bytes as one run of memory with Status.Overflow.