pub struct InvocationSession {
pub session_id: Option<Uuid>,
pub run_id: Option<RunId>,
/* private fields */
}Expand description
Invocation-time session context with temporary KV storage.
Passed as the second argument to on handlers and the first argument to
emit closures. Carries session_id, run_id, and a pluggable
SessionDataStore backend for ephemeral per-session data.
Fields§
§session_id: Option<Uuid>Session id, when known.
run_id: Option<RunId>Run id, when known.
Implementations§
Source§impl InvocationSession
impl InvocationSession
Sourcepub async fn set_data(
&self,
key: impl Into<String>,
value: Value,
) -> Result<(), SessionDataError>
pub async fn set_data( &self, key: impl Into<String>, value: Value, ) -> Result<(), SessionDataError>
Stores a temporary value in the session data store.
§Errors
Returns SessionDataError when the session id is unknown or the
backend fails.
Sourcepub async fn get_data(
&self,
key: &str,
) -> Result<Option<Value>, SessionDataError>
pub async fn get_data( &self, key: &str, ) -> Result<Option<Value>, SessionDataError>
Retrieves a temporary value from the session data store.
Returns Ok(None) when the key does not exist.
§Errors
Returns SessionDataError when the session id is unknown or the
backend fails.
Sourcepub async fn delete_data(&self, key: &str) -> Result<(), SessionDataError>
pub async fn delete_data(&self, key: &str) -> Result<(), SessionDataError>
Deletes a temporary value from the session data store.
Deleting a non-existent key is a no-op.
§Errors
Returns SessionDataError when the session id is unknown or the
backend fails.