Skip to main content

SessionStore

Struct SessionStore 

Source
pub struct SessionStore { /* private fields */ }

Implementations§

Source§

impl SessionStore

Source

pub fn open(data_root: &Path, cwd: &Path) -> Result<Arc<Self>, SessionError>

Source

pub fn data_root(&self) -> &Path

The data root this store was opened against.

Source

pub fn create( &self, session_id: SessionId, origin: EventOrigin, creation: EventPayload, ) -> Result<Arc<EventLog>, SessionError>

Source

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.

Source

pub fn get(&self, id: SessionId) -> Result<SessionProjection, SessionError>

Source

pub fn get_resident(&self, id: SessionId) -> Option<SessionProjection>

Source

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.

Source

pub fn evict(&self, id: SessionId) -> Result<bool, SessionError>

Source

pub fn append( &self, id: SessionId, run: Option<RunId>, origin: EventOrigin, event: EventPayload, ) -> Result<StoredEvent, SessionError>

Source

pub fn fork( &self, source_id: SessionId, through_seq: u64, origin: EventOrigin, ) -> Result<SessionId, SessionError>

Source

pub fn all(&self) -> Vec<SessionProjection>

Source

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).

Source

pub fn all_summaries(&self) -> Vec<SessionSummary>

Source

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).

Source

pub fn session_usage( &self, id: SessionId, pricing: &PricingConfig, catalog: &BTreeMap<ModelKey, CatalogModelCost>, ) -> Result<SessionUsageResult, SessionError>

Source

pub fn is_resident(&self, id: SessionId) -> bool

Source

pub fn resident_subagent_count(&self) -> usize

Source

pub fn workdir_dir_path(&self) -> &Path

Directory holding the work-dir files (artifacts, the grant journal, runtime revisions, cwd and layout.json).

Source

pub fn cwd(&self) -> &Path

Source

pub fn is_persisted(&self, id: SessionId) -> Result<bool, SessionError>

Source

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).

Source

pub fn tree(&self, id: SessionId) -> Result<SessionTree, SessionError>

Trait Implementations§

Source§

impl Debug for SessionStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SessionStore

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more