Skip to content

Implement snapshot-based persistence #39

Open

Description

@AlexJuca

Context

FKVS currently stores data in memory. Snapshot persistence is needed if FKVS is expected to recover state after restart or crash. This issue tracks RDB-style point-in-time persistence.

Related PR: #69 proposes an implementation and should be reviewed against the acceptance criteria below.

Scope

  • Serialize the key/value store and TTL metadata to disk.
  • Load snapshots on startup before accepting client traffic.
  • Discard expired keys during load.
  • Write snapshots atomically using temp file + fsync + rename.
  • Include format versioning and corruption detection.
  • Add configuration for snapshot path and save interval/threshold.
  • Define behavior for disabled persistence.

Acceptance criteria

  • Restarting the server restores non-expired keys from a snapshot.
  • Corrupt or partial snapshot files are detected and handled safely.
  • Snapshot writes cannot leave the configured snapshot path with a torn file.
  • Snapshotting has tests for strings, integer encoding, TTLs, expired keys, empty DB, missing files, and corrupt files.
  • README/server config docs explain the durability guarantees and limitations.

Activity

  1. added a commit that references this issue on Mar 3, 2026
    c9a2985
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions