pub trait SessionStore:
Send
+ Sync
+ 'static {
// Required methods
fn create_session(
&self,
ctx: &TenantCtx,
data: SessionData,
) -> GResult<SessionKey>;
fn get_session(&self, key: &SessionKey) -> GResult<Option<SessionData>>;
fn update_session(&self, key: &SessionKey, data: SessionData) -> GResult<()>;
fn remove_session(&self, key: &SessionKey) -> GResult<()>;
fn find_by_user(
&self,
ctx: &TenantCtx,
user: &UserId,
) -> GResult<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§
Sourcefn create_session(
&self,
ctx: &TenantCtx,
data: SessionData,
) -> GResult<SessionKey>
fn create_session( &self, ctx: &TenantCtx, data: SessionData, ) -> GResult<SessionKey>
Creates a new session associated with the supplied tenant context and returns its key.
Sourcefn get_session(&self, key: &SessionKey) -> GResult<Option<SessionData>>
fn get_session(&self, key: &SessionKey) -> GResult<Option<SessionData>>
Fetches the session payload for the provided key, if it exists.
Sourcefn update_session(&self, key: &SessionKey, data: SessionData) -> GResult<()>
fn update_session(&self, key: &SessionKey, data: SessionData) -> GResult<()>
Replaces the session payload for the provided key.
Sourcefn remove_session(&self, key: &SessionKey) -> GResult<()>
fn remove_session(&self, key: &SessionKey) -> GResult<()>
Removes the session entry and clears any lookup indices.
Sourcefn find_by_user(
&self,
ctx: &TenantCtx,
user: &UserId,
) -> GResult<Option<(SessionKey, SessionData)>>
fn find_by_user( &self, ctx: &TenantCtx, user: &UserId, ) -> GResult<Option<(SessionKey, SessionData)>>
Finds the active session bound to the specified tenant + user combination.