pub struct SessionStore { /* private fields */ }Implementations§
Source§impl SessionStore
impl SessionStore
pub fn open(data_root: &Path, cwd: &Path) -> Result<Arc<Self>, SessionError>
pub fn create( &self, session_id: SessionId, origin: EventOrigin, creation: EventPayload, ) -> Result<Arc<EventLog>, SessionError>
Sourcepub fn create_with_status(
&self,
session_id: SessionId,
origin: EventOrigin,
creation: EventPayload,
) -> Result<(Arc<EventLog>, bool), SessionError>
pub fn create_with_status( &self, session_id: SessionId, origin: EventOrigin, creation: EventPayload, ) -> Result<(Arc<EventLog>, bool), SessionError>
Creates a session atomically and reports whether this caller won creation.
pub fn get(&self, id: SessionId) -> Result<SessionProjection, SessionError>
pub fn get_resident(&self, id: SessionId) -> Option<SessionProjection>
Sourcepub fn is_owned(&self, id: SessionId) -> bool
pub fn is_owned(&self, id: SessionId) -> bool
Whether this process may write id: its tree is held and settled here,
and id itself was created or adopted in this process. A foreign root
therefore answers false for every session in its tree.
pub fn evict(&self, id: SessionId) -> Result<bool, SessionError>
pub fn append( &self, id: SessionId, run: Option<RunId>, origin: EventOrigin, event: EventPayload, ) -> Result<StoredEvent, SessionError>
pub fn fork( &self, source_id: SessionId, through_seq: u64, origin: EventOrigin, ) -> Result<SessionId, SessionError>
pub fn all(&self) -> Vec<SessionProjection>
Sourcepub fn root_snapshots(&self) -> Vec<SessionProjection>
pub fn root_snapshots(&self) -> Vec<SessionProjection>
Snapshots of the sessions that are roots of their own tree. This is the startup pass shape: never touches delegated child logs and never triggers a lazy tree load (§3.2, §4).
pub fn all_summaries(&self) -> Vec<SessionSummary>
Sourcepub fn summary(&self, id: SessionId) -> Result<SessionSummary, SessionError>
pub fn summary(&self, id: SessionId) -> Result<SessionSummary, SessionError>
One session’s summary: a resident projection, a cached summary the store can prove is current, or — after completing the owning root’s tree — the answer the bulk pass installed (§2.4, §3.2).
A summary that cannot be proven current is pre-load data: the persisted
subagents/index.json is a cache, and the one thing that proves a cached
entry has fallen behind is a disagreement with the session’s own
authoritative metadata file. Serving it anyway is how a usage query ends
up reporting an incomplete tree (session_usage and
Engine::session_tree_usage both answer from this method), so the tree is
completed first. The hot path stays lock-light: an already-loaded tree
costs one placement probe and one tree-state probe, no filesystem access,
and a caller holding mutation never starts a load here (§3.2, review F2).
pub fn session_usage( &self, id: SessionId, pricing: &PricingConfig, catalog: &BTreeMap<ModelKey, CatalogModelCost>, ) -> Result<SessionUsageResult, SessionError>
pub fn is_resident(&self, id: SessionId) -> bool
pub fn resident_subagent_count(&self) -> usize
Sourcepub fn workdir_dir_path(&self) -> &Path
pub fn workdir_dir_path(&self) -> &Path
Directory holding the work-dir files (artifacts, the grant journal,
runtime revisions, cwd and layout.json).
pub fn cwd(&self) -> &Path
pub fn is_persisted(&self, id: SessionId) -> Result<bool, SessionError>
Sourcepub fn children(
&self,
parent: SessionId,
) -> Result<Vec<ChildSummary>, SessionError>
pub fn children( &self, parent: SessionId, ) -> Result<Vec<ChildSummary>, SessionError>
Every direct child of parent, resolved from placement rather than by
scanning every resident projection: seeded tree state + location cache,
then a subagents/ directory scan that adopts children no cache
mentions from their metadata cache alone (§3.4). No child event log is
read here — children of a cold tree report their persisted status.
Fails when the tree itself could not be completed: a listing built from
the pre-load cache would silently report a stale tree, so the caller gets
the load error instead (review L14). A missing or stale index.json is
not such a failure — the directory scan recovers it (§3.4).