SessionStore

Trait SessionStore 

Source
pub trait SessionStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn create_session(
        &self,
        ctx: &TenantCtx,
        data: SessionData,
    ) -> SessionResult<SessionKey>;
    fn get_session(
        &self,
        key: &SessionKey,
    ) -> SessionResult<Option<SessionData>>;
    fn update_session(
        &self,
        key: &SessionKey,
        data: SessionData,
    ) -> SessionResult<()>;
    fn remove_session(&self, key: &SessionKey) -> SessionResult<()>;
    fn find_by_user(
        &self,
        ctx: &TenantCtx,
        user: &UserId,
    ) -> SessionResult<Option<(SessionKey, SessionData)>>;
}
Expand description

Persistent session storage interface used by Greentic runtimes.

SessionData captures the tenant context, flow identifier, cursor, and serialized execution state snapshot for an in-flight flow. Implementations store that payload so runners can pause execution, persist the snapshot, and resume the flow consistently after new input arrives.

Required Methods§

Source

fn create_session( &self, ctx: &TenantCtx, data: SessionData, ) -> SessionResult<SessionKey>

Creates a new session associated with the supplied tenant context and returns its key.

Source

fn get_session(&self, key: &SessionKey) -> SessionResult<Option<SessionData>>

Fetches the session payload for the provided key, if it exists.

Source

fn update_session( &self, key: &SessionKey, data: SessionData, ) -> SessionResult<()>

Replaces the session payload for the provided key.

Source

fn remove_session(&self, key: &SessionKey) -> SessionResult<()>

Removes the session entry and clears any lookup indices.

Source

fn find_by_user( &self, ctx: &TenantCtx, user: &UserId, ) -> SessionResult<Option<(SessionKey, SessionData)>>

Finds the active session bound to the specified tenant + user combination.

Implementors§