Skip to main content

SqlxTaskStorage

Struct SqlxTaskStorage 

Source
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

Source

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.

Source

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.

Source

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.

Source

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

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,

Get a push-notification config for a task.
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,

List all push-notification configs for a task.
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,

Delete a push-notification config. Idempotent per the v1.0.0 spec.
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,

Create or replace a push-notification config, returning it with any server-assigned ID populated.
Source§

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,

Create a new task in the given context.
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,

Update task status, optionally appending a message to history.
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,

Check whether a task exists.
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,

Get a task by ID with optional history length limit.
Source§

fn cancel<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel a task.
Source§

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,

List tasks with filtering and pagination (A2A v1.0.0 tasks/list).
Source§

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,

Current stored version of a task. Bumped on every successful mutation.
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,

Fetch a task together with its current version (history-limited as in 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,

Update status only if the stored version equals expected. Read more
Source§

impl Clone for SqlxTaskStorage

Available on crate feature sqlx-storage only.
Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsyncNotificationManagerExt for T

Source§

fn validate_config( &self, config: &TaskPushNotificationConfig, ) -> Result<(), A2AError>

Validate a push-notification config’s webhook URL.
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,

Validate the task ID and webhook URL, then store the config.
Source§

impl<T> AsyncTaskLifecycleExt for T

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,

Validate query parameters, then fetch the task.
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,

Validate ID parameters, then cancel the task.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more