Documentation
¶
Overview ¶
Package file provides a local JSON-backed session store for Glue.
It writes one file per session below a configured directory using atomic temp-file-plus-rename writes, and implements the glue.Store interface. It is the simple default with no extra dependencies; reach for stores/sqlite when you need cross-session search.
Package file provides a local JSON-backed session store for Glue.
Each session is written to <dir>/<url-escaped-id>.json. Saves are atomic: the JSON payload is first written to a sibling temp file in the same directory and then os.Rename'd into place, so concurrent readers either see the previous file or the new file but never a partial write.
Index ¶
- type Store
- func (s *Store) Delete(_ context.Context, id string) error
- func (s *Store) ListSessions(ctx context.Context, opts glue.ListSessionsOptions) ([]glue.SessionSummary, error)
- func (s *Store) Load(_ context.Context, id string) (glue.SessionState, bool, error)
- func (s *Store) Path(id string) (string, error)
- func (s *Store) Save(_ context.Context, id string, state glue.SessionState) error
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 persists Glue sessions as local JSON files.
func New ¶
New creates a file-backed store rooted at dir. The directory is created on first save; calling New does not touch the filesystem.
func (*Store) ListSessions ¶
func (s *Store) ListSessions(ctx context.Context, opts glue.ListSessionsOptions) ([]glue.SessionSummary, error)
ListSessions implements glue.SessionLister by scanning JSON session files.