Files
aevolution/schemas/local-world-manifest.md

54 lines
2.4 KiB
Markdown

# Local world manifest v1
This is an M5.7 single-host publication record, not a production/world-server
manifest. The encoding is fixed-width little-endian and exactly 88 bytes:
| Offset | Width | Field |
|---:|---:|---|
| 0 | 8 | magic `0x0031464d574f5645` |
| 8 | 4 | version `1` |
| 12 | 4 | total length `88` |
| 16 | 8 | world identity |
| 24 | 8 | frame identity |
| 32 | 8 | generation, nonzero |
| 40 | 8 | FNV-1a checksum of complete snapshot payload |
| 48 | 8 | snapshot command high-water |
| 56 | 1 | journal-present flag, 0 or 1 |
| 57 | 7 | reserved zero bytes |
| 64 | 8 | FNV-1a checksum of complete journal payload, or zero |
| 72 | 8 | journal final command, or zero |
| 80 | 8 | FNV-1a checksum of bytes 0 through 79 |
FNV detects accidental corruption only. It is not authentication. Payload names
are derived from their checksum and complete bytes are compared when a name
already exists. A manifest reference is accepted only after the M5.6 snapshot
restore and optional all-or-nothing journal replay succeed.
## Publication and recovery
The writer holds the per-world OS lock. It writes a same-directory temporary
payload and flushes it, installs a new immutable payload name, then flushes the
directory. It writes and flushes the inactive manifest temporary and atomically
replaces that manifest slot. The replacement is the commit point. Slots alternate
by generation. Recovery parses both slots and selects the greatest generation;
any malformed present slot or invalid selected payload fails closed. It never
silently falls back from a valid published pointer to an older generation.
```mermaid
stateDiagram-v2
[*] --> PreparePayload
PreparePayload --> PayloadSynced
PayloadSynced --> PayloadInstalled
PayloadInstalled --> PrepareInactiveManifest
PrepareInactiveManifest --> ManifestSynced
ManifestSynced --> Published: atomic replace (commit)
ManifestSynced --> PreviousGeneration: failure before replace
Published --> ReopenRequired: ambiguous/post-publication error
Published --> Recoverable: durable slot + referenced payload
```
An interruption before replacement recovers the old generation. An interruption
after replacement recovers the new generation. Unknown files and orphan payloads
are ignored; this version does not delete them. OS locks, fsync/write-through and
same-directory rename semantics depend on the local filesystem and storage stack.