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.
The scheme picks the backend: sqlite::memory:, sqlite:data.db, or
postgres://user:pass@host/db. Each needs its cargo feature (sqlite,
postgres) compiled in, and the error says so when it is missing.
Pool sizing, statement logging, a custom push sender and agent-specific
migrations go through builder.
Sourcepub fn builder(database_url: impl Into<String>) -> SqlxStorageBuilder
pub fn builder(database_url: impl Into<String>) -> SqlxStorageBuilder
Configure a store before opening it.
let storage = SqlxTaskStorage::builder("postgres://user:pass@localhost/a2a")
.max_connections(20)
.log_statements(true)
.connect()
.await?;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.
Sourcepub fn max_connections(&self) -> u32
pub fn max_connections(&self) -> u32
The connection cap the pool was opened with — what
SqlxStorageBuilder::max_connections asked for, read back off the
pool. On PostgreSQL this is the store’s share of a server-wide limit.
Trait Implementations§
Source§impl AsyncContextStateStore for SqlxTaskStorage
impl AsyncContextStateStore for SqlxTaskStorage
Source§fn load_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<ContextState, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<ContextState, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
user: keys. Read moreSource§fn remember<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
value: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Remembered, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn remember<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
value: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Remembered, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Source§fn forget<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn forget<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
key: &'life3 StateKey,
) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
key, reporting whether it held anything. Read moreSource§impl AsyncConversationStore for SqlxTaskStorage
impl AsyncConversationStore for SqlxTaskStorage
Source§fn load<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
limit: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
digest: Digest,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn compact<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
digest: Digest,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Digest::covers_through, claiming the context for caller if it is
new. Read moreSource§impl AsyncEventLog for SqlxTaskStorage
impl AsyncEventLog for SqlxTaskStorage
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
event: UpdateEvent,
) -> Pin<Box<dyn Future<Output = Result<SeqEvent, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
event: UpdateEvent,
) -> Pin<Box<dyn Future<Output = Result<SeqEvent, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
event as the next event on task_id’s stream and return it
with the id it was given. Read moreSource§fn replay<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
from: u64,
) -> Pin<Box<dyn Future<Output = Result<Replay, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replay<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
from: u64,
) -> Pin<Box<dyn Future<Output = Result<Replay, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
from.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 AsyncRetention for SqlxTaskStorage
impl AsyncRetention for SqlxTaskStorage
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> AsyncConversationStoreExt for Twhere
T: AsyncConversationStore + ?Sized,
impl<T> AsyncConversationStoreExt for Twhere
T: AsyncConversationStore + ?Sized,
Source§fn load_recent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
keep: u32,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_recent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
keep: u32,
) -> Pin<Box<dyn Future<Output = Result<Conversation, A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
keep of the most recent messages.Source§fn compact_through<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
conversation: &'life3 Conversation,
summary: String,
model: String,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn compact_through<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
context_id: &'life1 ContextId,
caller: Option<&'life2 str>,
conversation: &'life3 Conversation,
summary: String,
model: String,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
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