Data Format
This page documents the actual binary persistence format currently implemented in Moongate v2.
Serialization Technology
- Serializer:
MemoryPack - Snapshot container:
WorldSnapshot - Journal payload item:
JournalEntry
Snapshot File
Path:
save/world.snapshot.bin
Write behavior:
- Serialize
WorldSnapshottoworld.snapshot.bin.tmp - Flush stream
- Replace target file with atomic move
Read behavior:
- If snapshot file does not exist: returns
null - Otherwise: deserializes
WorldSnapshotwith MemoryPack
There is no trailing checksum block in the snapshot file.
Journal File
Path:
save/world.journal.bin
Each record layout in the file:
[int32 payloadLength LE]
[byte[payloadLength] payload]
[uint32 checksum LE]
Where:
payloadisMemoryPackSerializer.Serialize(entry)checksumis computed frompayload
Journal Validation Rules
During replay (ReadAllAsync):
- Record length must be present and valid
- Length must be in allowed bounds
- Payload must be fully readable
- Checksum must match
- Payload must deserialize to
JournalEntry
Replay stops at first invalid/truncated record.
Operational Lifecycle
- Repositories append operations to journal
- Unit of work builds fresh
WorldSnapshotfrom state store - Snapshot save completes
- Journal is reset (
FileMode.Create)
Persistence Options
PersistenceOptions currently includes exactly:
SnapshotFilePathJournalFilePath
No extra sidecar/checksum/history paths are currently configured.
Previous: Persistence Overview | Next: Persistence Repositories