fsstore

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package fsstore is a reference, test-only persistent checkpoint backend that stores checkpoints as JSON files on disk. It exists to exercise the pluggable backend seam (registry + mirror fan-out) with a real, non-git implementation of the api/checkpoint contract, and to serve as a worked example for new backends.

It is deliberately NOT registered by production code: only a test-only helper (registerForTesting, in register_test.go) wires it into the checkpoint registry, so a production binary can never select it. As a mirror it receives best-effort write fan-out; it intentionally ignores the git-specific blob-hash fields of the contract and stores transcript bytes directly, which keeps the example small and makes the contract's remaining git leakage concrete.

It is faithful to the contract's per-session metadata and write-request semantics — including prompt and summary redaction via the shared checkpoint helpers — but it does not replicate two git-writer behaviors: cross-session aggregation (the root summary's TokenUsage reflects the latest session, not a sum) and derived stamps the git writer adds (CLI version, skill-events version). Neither is needed to validate the pluggable seam.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a JSON-file-backed persistent checkpoint store. One file per checkpoint (<root>/<checkpoint-id>.json) holds the root summary plus all session content.

func New

func New(dir string) *Store

New constructs a filesystem store rooted at dir.

func (*Store) List

func (s *Store) List(_ context.Context) ([]cp.CheckpointInfo, error)

func (*Store) Read

func (s *Store) Read(_ context.Context, checkpointID id.CheckpointID) (*cp.CheckpointSummary, error)

Read returns the checkpoint summary, or (nil, nil) when absent so the contract helper normalizes it to ErrCheckpointNotFound.

func (*Store) ReadSessionContent

func (s *Store) ReadSessionContent(_ context.Context, checkpointID id.CheckpointID, sessionIndex int) (*cp.SessionContent, error)

func (*Store) ReadSessionMetadata

func (s *Store) ReadSessionMetadata(_ context.Context, checkpointID id.CheckpointID, sessionIndex int) (*cp.Metadata, error)

func (*Store) ReadSessionMetadataAndPrompts

func (s *Store) ReadSessionMetadataAndPrompts(_ context.Context, checkpointID id.CheckpointID, sessionIndex int) (*cp.Metadata, string, error)

func (*Store) ReadSessionPrompts

func (s *Store) ReadSessionPrompts(_ context.Context, checkpointID id.CheckpointID, sessionIndex int) (string, error)

func (*Store) Write

func (s *Store) Write(_ context.Context, req cp.WriteRequest) error

Write dispatches on the request type, mirroring the git store's Write.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL