pub trait PushConfigStore:
Send
+ Sync
+ 'static {
// Required methods
fn set<'a>(
&'a self,
config: TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = A2aResult<TaskPushNotificationConfig>> + Send + 'a>>;
fn get<'a>(
&'a self,
task_id: &'a str,
id: &'a str,
) -> Pin<Box<dyn Future<Output = A2aResult<Option<TaskPushNotificationConfig>>> + Send + 'a>>;
fn list<'a>(
&'a self,
task_id: &'a str,
) -> Pin<Box<dyn Future<Output = A2aResult<Vec<TaskPushNotificationConfig>>> + Send + 'a>>;
fn delete<'a>(
&'a self,
task_id: &'a str,
id: &'a str,
) -> Pin<Box<dyn Future<Output = A2aResult<()>> + Send + 'a>>;
// Provided method
fn count(
&self,
) -> Pin<Box<dyn Future<Output = A2aResult<Option<usize>>> + Send + '_>> { ... }
}Expand description
Trait for storing push notification configurations.
Object-safe; used as Box<dyn PushConfigStore>.
Required Methods§
Sourcefn set<'a>(
&'a self,
config: TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = A2aResult<TaskPushNotificationConfig>> + Send + 'a>>
fn set<'a>( &'a self, config: TaskPushNotificationConfig, ) -> Pin<Box<dyn Future<Output = A2aResult<TaskPushNotificationConfig>> + Send + 'a>>
Sourcefn get<'a>(
&'a self,
task_id: &'a str,
id: &'a str,
) -> Pin<Box<dyn Future<Output = A2aResult<Option<TaskPushNotificationConfig>>> + Send + 'a>>
fn get<'a>( &'a self, task_id: &'a str, id: &'a str, ) -> Pin<Box<dyn Future<Output = A2aResult<Option<TaskPushNotificationConfig>>> + Send + 'a>>
Provided Methods§
Sourcefn count(
&self,
) -> Pin<Box<dyn Future<Output = A2aResult<Option<usize>>> + Send + '_>>
fn count( &self, ) -> Pin<Box<dyn Future<Output = A2aResult<Option<usize>>> + 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".