Skip to main content

SessionService

Trait SessionService 

Source
pub trait SessionService: Send + Sync {
    // Required methods
    fn create<'life0, 'async_trait>(
        &'life0 self,
        req: CreateRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Session>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'async_trait>(
        &'life0 self,
        req: GetRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Session>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
        req: ListRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Session>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        req: DeleteRequest,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn append_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        event: Event,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get_for_identity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        identity: &'life1 AdkIdentity,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Session>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn delete_for_identity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        identity: &'life1 AdkIdentity,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn append_event_for_identity<'life0, 'async_trait>(
        &'life0 self,
        req: AppendEventRequest,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn delete_all_sessions<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        app_name: &'life1 str,
        user_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn create<'life0, 'async_trait>( &'life0 self, req: CreateRequest, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get<'life0, 'async_trait>( &'life0 self, req: GetRequest, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn list<'life0, 'async_trait>( &'life0 self, req: ListRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Session>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn delete<'life0, 'async_trait>( &'life0 self, req: DeleteRequest, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn append_event<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, event: Event, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn get_for_identity<'life0, 'life1, 'async_trait>( &'life0 self, identity: &'life1 AdkIdentity, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Session>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a session using typed AdkIdentity addressing.

This is the preferred path for new code. It constructs a GetRequest from the full (app_name, user_id, session_id) triple so that session lookup is unambiguous.

The default implementation delegates to get with a freshly built GetRequest.

§Errors

Returns an error if the session cannot be retrieved.

Source

fn delete_for_identity<'life0, 'life1, 'async_trait>( &'life0 self, identity: &'life1 AdkIdentity, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a session using typed AdkIdentity addressing.

This is the preferred path for new code. It constructs a DeleteRequest from the full (app_name, user_id, session_id) triple so that session deletion is unambiguous.

The default implementation delegates to delete with a freshly built DeleteRequest.

§Errors

Returns an error if the session cannot be deleted.

Source

fn append_event_for_identity<'life0, 'async_trait>( &'life0 self, req: AppendEventRequest, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Append an event to a session using typed AdkIdentity addressing.

This is the preferred path for new code. It uses the full (app_name, user_id, session_id) triple so that session lookup is unambiguous even when the same session_id string appears under different apps or users.

The default implementation delegates to the legacy append_event method using only the session_id component. Backends that support composite-key addressing should override this method to use all three identity fields.

§Errors

Returns an error if the event cannot be appended.

Source

fn delete_all_sessions<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, app_name: &'life1 str, user_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete all sessions for a given app and user.

Removes all sessions and their associated events. Useful for bulk cleanup and GDPR right-to-erasure compliance. The default implementation returns an error.

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify backend connectivity.

Returns Ok(()) if the backend is reachable and responsive. Use this for Kubernetes readiness probes and /healthz endpoints. The default implementation always succeeds (suitable for in-memory).

Implementors§