public static class ChunkFormatThe chunk container: a header, a payload, and a compression wrapper around both.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Two layers, and the boundary between them is the whole design. The chunk — header plus payload — is what gets hashed into an ObjectId. The blob — a compression byte, the uncompressed length, and the possibly-compressed chunk — is what a backend stores.
Keeping compression outside the hashed region is what makes the id a property of the content rather than of the policy. Two builds that disagree about whether to LZ4 a mesh still produce the same id for it, so an incremental update sees no change, a bundle built with different settings still deduplicates against the loose files, and the determinism gate compares content instead of comparing settings.
The header carries the references rather than leaving them implicit in the payload, because loading has to be able to resolve a graph without deserialising it first: read header, load what it names, then deserialise. That is also what lets a bundle packer see the dependency graph without understanding a single asset type.
Fields and properties (2)
public const int VersionThe container version, bumped when the header layout changes.
public const int MinimumCompressedSizePayloads below this are stored uncompressed whatever the policy says.
Methods (4)
public static byte[] BuildChunk(ulong typeId, ReadOnlySpan<ObjectId> references, ReadOnlySpan<byte> payload)Builds a chunk: the header and payload that together get hashed.
public static int ReadHeader(ReadOnlySpan<byte> chunk, out ulong typeId, out ImmutableArray<ObjectId> references)Reads a chunk's header.
public static byte[] Pack(ReadOnlySpan<byte> chunk, CompressionMethod method)Wraps a chunk for storage, compressing it if that is worth doing.
public static byte[] Unpack(ReadOnlySpan<byte> blob, out CompressionMethod method)Unwraps a stored blob back into a chunk.
Used by (2)
- ObjectDatabaseVixen.Core.Serialization
- ObjectDatabaseTestsVixen.Core.Serialization.Tests