On-Disk Layout

Root and Subtrees

  • Store root is storage.local_root.

  • Segment data is rooted under ${local_root}/segments/.

  • Paths are derived by stable helper functions, not ad hoc string concatenation.

Stable Layout Contract

edge/storage/layout.go defines the canonical layout contract:

  • SegmentFileExt = ".seg"

  • MetadataFileExt = ".meta"

  • safeName(segment_id) = hex-encoded segment ID bytes

  • shardPrefix = first two hex chars (256 shard buckets)

  • segmentPath(root,id) and metadataPath(root,id) compute final paths

  • segmentsRootDir(root) computes top-level segment directory

Commit and Recovery Semantics

  • Segment commit marker is the .meta file.

  • A .seg without .meta is treated as uncommitted.

  • Recovery removes temp files and orphan pairs on startup.

  • Runtime storage operations (Write, Read, Delete, Stats) use the same path helpers and extensions.

Evidence

  • edge/storage/layout.go (SegmentFileExt, MetadataFileExt, segmentPath, metadataPath, segmentsRootDir)

  • edge/storage/localstore.go (path helper usage in write/read/delete/stats paths)

  • edge/storage/recovery.go (recovery walk and orphan/temp cleanup)

  • edge/storage/layout_test.go

  • edge/storage/crash_test.go

See Also