Skip to main content

PushConfigStore

Trait PushConfigStore 

Source
pub trait PushConfigStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn set<'a>(
        &'a self,
        config: TaskPushNotificationConfig,
    ) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2aError>> + Send + 'a>>;
    fn get<'a>(
        &'a self,
        task_id: &'a str,
        id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TaskPushNotificationConfig>, A2aError>> + Send + 'a>>;
    fn list<'a>(
        &'a self,
        task_id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2aError>> + Send + 'a>>;
    fn delete<'a>(
        &'a self,
        task_id: &'a str,
        id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>;

    // Provided methods
    fn is_process_local(&self) -> bool { ... }
    fn isolates_tenants(&self) -> bool { ... }
    fn count(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<usize>, A2aError>> + Send + '_>> { ... }
}
Expand description

Trait for storing push notification configurations.

Object-safe; used as Box<dyn PushConfigStore>.

Required Methods§

Source

fn set<'a>( &'a self, config: TaskPushNotificationConfig, ) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2aError>> + Send + 'a>>

Stores (creates or updates) a push notification config.

§Errors

Returns an A2aError if the operation fails.

Source

fn get<'a>( &'a self, task_id: &'a str, id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskPushNotificationConfig>, A2aError>> + Send + 'a>>

Retrieves a push notification config by task ID and config ID.

§Errors

Returns an A2aError if the operation fails.

Source

fn list<'a>( &'a self, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2aError>> + Send + 'a>>

Lists all push notification configs for a task.

§Errors

Returns an A2aError if the operation fails.

Source

fn delete<'a>( &'a self, task_id: &'a str, id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>

Deletes a push notification config by task ID and config ID.

§Errors

Returns an A2aError if the operation fails.

Provided Methods§

Source

fn is_process_local(&self) -> bool

Whether this store keeps its state in this process alone.

The default is false: a store this crate cannot see into (yours, over Redis, say) is taken to be shared. The in-memory ones answer true. Profile::Production reads it: on a task store that is shared between processes, a store that only this process can see makes the fleet behave as if it had no store (audit E-F13).

Source

fn isolates_tenants(&self) -> bool

Whether this store partitions configs by tenant. Same contract as TaskStore::isolates_tenants: defaults to false, and the handler refuses a request that names a tenant unless both stores answer true.

Source

fn count( &self, ) -> Pin<Box<dyn Future<Output = Result<Option<usize>, A2aError>> + Send + '_>>

Returns the total number of stored configs the handler should count against its global ceiling, or None if this backend does not report a count (in which case only the per-task cap is enforced).

Implementations that can answer cheaply (an in-memory size, a SQL COUNT(*)) return Some(n) so the handler can bound total growth uniformly — without it, configs spread across unboundedly many task ids grow a SQL-backed store without limit. Tenant-scoped stores report the count for the current tenant, yielding a per-tenant ceiling.

The default returns None so existing custom implementations keep compiling and behave exactly as before.

§Errors

Returns an A2aError if the operation fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§