yera.ui.sessions_store.sqlite_store
Module for the SQLite-based session store.
Symbols
SQLiteSessionStore
BaseSessionStoreSQLite-based implementation of BaseSessionStore.
The store creates a tiny SQLite database (WAL mode, foreign keys enabled) in the user's home directory unless another path is supplied. It provides CRUD operations for session metadata and an event log stored as JSON strings.
Methods
SQLiteSessionStore.create
create(
app_id: str,
) → SessionRecordCreate a new session record for app_id.
Parameters
Identifier of the application that owns the session.
Returns
The newly created :class:SessionRecord.
SQLiteSessionStore.has
has(
session_id: str,
) → boolReturn True if a session with session_id exists in the store.
Parameters
The UUID of the session to look up.
Returns
True if the session is present, otherwise False.
SQLiteSessionStore.has_events
has_events(
session_id: str,
) → boolCheck whether any events are stored for session_id.
Parameters
The UUID of the session whose event log is queried.
Returns
True if at least one event exists, otherwise False.
SQLiteSessionStore.get
get(
session_id: str,
) → SessionRecordRetrieve the :class:SessionRecord for session_id.
Parameters
The UUID of the desired session.
Returns
The corresponding :class:SessionRecord.
Raises
If no such session exists.
SQLiteSessionStore.list
list() → list[SessionRecord]Return all stored sessions ordered by most recent update time.
Returns
A list of :class:SessionRecord objects sorted descending by updated_at.
SQLiteSessionStore.update
update(
session_id: str,
title: str | None = None,
status: SessionStatus | None = None,
) → NoneUpdate metadata for session_id.
Parameters
The UUID of the session to modify.
Optional new title. If omitted, only the updated_at timestamp is refreshed.
An optional new lifecycle status for the session.
Raises
If the specified session does not exist.
SQLiteSessionStore.append_event
append_event(
session_id: str,
event: OutputEvent | InputEvent,
update: SessionRecordUpdate | None = None,
) → NoneAppend an event to the log of session_id.
Parameters
The UUID of the target session.
An event to store.
Optional session metadata changes to apply atomically.
Raises
If the session does not exist.
SQLiteSessionStore.read_events
read_events(
session_id: str,
) → Iterator[OutputEvent | InputEvent]Yield all events for session_id in chronological order.
Parameters
The UUID of the session whose events should be streamed.
Raises
If the session does not exist. Raised eagerly when
read_events is called.
If an unknown event type is encountered. Raised lazily during iteration, not at call time.
SQLiteSessionStore.__enter__
__enter__() → SelfEnter a runtime context and initialise the SQLite store.
Returns
self the open SQLiteSessionStore instance.
SQLiteSessionStore.__exit__
__exit__(
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) → NoneExit the runtime context, resetting the opened flag.