pub struct SqlxTaskStorage { /* private fields */ }Expand description
SQLx-based task storage for persistent storage.
Persistence-only: streaming fan-out lives in
InMemoryStreamingHandler and
push-webhook delivery behind the AsyncPushNotifier port (handed out via
push_notifier). The store still owns push-config
CRUD (AsyncNotificationManager) — that is config persistence.
Implementations§
Source§impl SqlxTaskStorage
impl SqlxTaskStorage
Sourcepub async fn new(database_url: &str) -> Result<Self, A2AError>
pub async fn new(database_url: &str) -> Result<Self, A2AError>
Create a new SQLx task storage with the given database URL.
Currently only SQLite URLs are supported (e.g. sqlite::memory:, sqlite:data.db).
Passing a PostgreSQL or MySQL URL will return an error.
Sourcepub async fn with_push_sender(
database_url: &str,
push_sender: impl PushNotificationSender + 'static,
) -> Result<Self, A2AError>
pub async fn with_push_sender( database_url: &str, push_sender: impl PushNotificationSender + 'static, ) -> Result<Self, A2AError>
Create a new SQLx task storage with a custom push notification sender.
Currently only SQLite URLs are supported.
Sourcepub async fn with_migrations(
database_url: &str,
additional_migrations: &[&str],
) -> Result<Self, A2AError>
pub async fn with_migrations( database_url: &str, additional_migrations: &[&str], ) -> Result<Self, A2AError>
Create a new SQLx task storage with additional migrations.
Currently only SQLite URLs are supported.
Sourcepub fn push_notifier(&self) -> Arc<dyn AsyncPushNotifier>
pub fn push_notifier(&self) -> Arc<dyn AsyncPushNotifier>
Hand out this store’s push-notification registry as an
AsyncPushNotifier.
The returned notifier shares the same config registry the store writes to
via AsyncNotificationManager::set_config, so a config registered on
the store is immediately visible to the notifier at the composition edge.
Trait Implementations§
Source§impl AsyncNotificationManager for SqlxTaskStorage
impl AsyncNotificationManager for SqlxTaskStorage
Source§fn get_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 GetTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 GetTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn list_configs<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTaskPushNotificationConfigsParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_configs<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTaskPushNotificationConfigsParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn delete_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 DeleteTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_config<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 DeleteTaskPushNotificationConfigParams,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn set_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_config<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl AsyncTaskLifecycle for SqlxTaskStorage
impl AsyncTaskLifecycle for SqlxTaskStorage
Source§fn create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
context_id: &'life2 ContextId,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
context_id: &'life2 ContextId,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl AsyncTaskQuery for SqlxTaskStorage
impl AsyncTaskQuery for SqlxTaskStorage
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTasksParams,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTasksParams,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
tasks/list).Source§impl AsyncTaskVersioning for SqlxTaskStorage
impl AsyncTaskVersioning for SqlxTaskStorage
Source§fn version<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<u64, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn version<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<u64, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_versioned<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_versioned<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
AsyncTaskLifecycle::get).Source§fn update_status_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
expected: u64,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_status_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
expected: u64,
state: TaskState,
message: Option<Message>,
) -> Pin<Box<dyn Future<Output = Result<VersionedTask, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
expected. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SqlxTaskStorage
impl !UnwindSafe for SqlxTaskStorage
impl Freeze for SqlxTaskStorage
impl Send for SqlxTaskStorage
impl Sync for SqlxTaskStorage
impl Unpin for SqlxTaskStorage
impl UnsafeUnpin for SqlxTaskStorage
Blanket Implementations§
Source§impl<T> AsyncNotificationManagerExt for Twhere
T: AsyncNotificationManager + ?Sized,
impl<T> AsyncNotificationManagerExt for Twhere
T: AsyncNotificationManager + ?Sized,
Source§fn validate_config(
&self,
config: &TaskPushNotificationConfig,
) -> Result<(), A2AError>
fn validate_config( &self, config: &TaskPushNotificationConfig, ) -> Result<(), A2AError>
Source§fn set_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<T> AsyncTaskLifecycleExt for Twhere
T: AsyncTaskLifecycle + ?Sized,
impl<T> AsyncTaskLifecycleExt for Twhere
T: AsyncTaskLifecycle + ?Sized,
Source§fn get_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskQueryParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskQueryParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn cancel_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskIdParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_validated<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 TaskIdParams,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more