Storage

Change the snapshot store, SnapshotQuery, index rebuild, or on-disk layout. Use when save/load, paging, corrupt files, or FileSnapshotStore behaviour is involved.

hoangsonww 75a36b0 890 B Updated

File contents

Storage

JSON files plus a rebuildable index.json. No database. Core code depends on the SnapshotStore protocol so tests can use InMemorySnapshotStore.

  • Snapshots are immutable after save. Only annotations (label, note, isPinned, tags) mutate.
  • SnapshotQuery.apply is the single filter implementation; stores must not reimplement filtering.
  • Duplicate saves throw StorageError.alreadyExists. Missing deletes throw .notFound.
  • Corrupt snapshot files are skipped on rebuildIndex, not fatal to the library.
  • Writes are atomic (temp file + replace).

Read Documentation/Storage.md. Tests: Tests/Domain/SnapshotServiceAndStoreTests.swift, Storage package suite.

hoangsonww/diffuse-native-apps/tree/main/.agents/skills/storage commit 75a36b06e4

Frequently asked questions

npx skillmds@latest add hoangsonww/storage