Documentation
¶
Overview ¶
Package session persists a session's events as redacted JSONL and reloads them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidID = errors.New("invalid session id")
ErrInvalidID means a session ID is not of the form s_<12 hex digits>.
var ErrLocked = errors.New("session already open")
ErrLocked means another process (or writer) already holds the session.
var ErrNoSession = errors.New("no session found")
ErrNoSession means no matching session exists.
Functions ¶
func Exists ¶
Exists reports ErrInvalidID for a malformed ID and ErrNoSession when <dir>/<sessionID>.jsonl does not exist; it creates nothing.
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock is a held session lock. It is taken before reading a session to resume, so that no other process writes it meanwhile, then handed over to the Writer by Open.
func Acquire ¶
Acquire creates dir (0700) and takes the session's lock (ErrLocked if another process or writer holds it).
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer appends one redacted, fsynced JSON line per event of its session. Safe for concurrent use.