pub struct SqlitePushConfigStore { /* private fields */ }Available on crate feature
sqlite only.Expand description
SQLite-backed PushConfigStore.
Stores push notification configs as JSON blobs in a push_configs table.
With with_cipher, each config is stored sealed
(spec §13.2); see PushConfigCipher.
§Schema
CREATE TABLE IF NOT EXISTS push_configs (
task_id TEXT NOT NULL,
id TEXT NOT NULL,
data TEXT NOT NULL,
PRIMARY KEY (task_id, id)
);Implementations§
Source§impl SqlitePushConfigStore
impl SqlitePushConfigStore
Sourcepub async fn new(url: &str) -> Result<SqlitePushConfigStore, Error>
pub async fn new(url: &str) -> Result<SqlitePushConfigStore, Error>
Opens (or creates) a SQLite database and initializes the schema.
§Errors
Returns an error if the database cannot be opened or the schema migration fails.
Sourcepub fn with_cipher(
self,
cipher: Arc<dyn PushConfigCipher>,
) -> SqlitePushConfigStore
pub fn with_cipher( self, cipher: Arc<dyn PushConfigCipher>, ) -> SqlitePushConfigStore
Seals each config this store writes with cipher, and opens each one
it reads (spec §13.2); see PushConfigCipher.
Sourcepub fn accept_unsealed_rows(self) -> SqlitePushConfigStore
pub fn accept_unsealed_rows(self) -> SqlitePushConfigStore
With a cipher, also reads configs stored unsealed, by this store
before with_cipher was set; each is sealed when
it is next written.
Sourcepub async fn from_pool(
pool: Pool<Sqlite>,
) -> Result<SqlitePushConfigStore, Error>
pub async fn from_pool( pool: Pool<Sqlite>, ) -> Result<SqlitePushConfigStore, Error>
Creates a store from an existing connection pool.
§Errors
Returns an error if the schema migration fails.
Trait Implementations§
Source§impl Clone for SqlitePushConfigStore
impl Clone for SqlitePushConfigStore
Source§fn clone(&self) -> SqlitePushConfigStore
fn clone(&self) -> SqlitePushConfigStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqlitePushConfigStore
impl Debug for SqlitePushConfigStore
Source§impl PushConfigStore for SqlitePushConfigStore
impl PushConfigStore for SqlitePushConfigStore
Source§fn is_process_local(&self) -> bool
fn is_process_local(&self) -> bool
Whether this store keeps its state in this process alone. Read more
Source§fn set<'a>(
&'a self,
config: TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2aError>> + Send + 'a>>
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. Read more
Source§fn get<'a>(
&'a self,
task_id: &'a str,
id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<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>>
Retrieves a push notification config by task ID and config ID. Read more
Source§fn list<'a>(
&'a self,
task_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2aError>> + Send + 'a>>
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. Read more
Source§fn delete<'a>(
&'a self,
task_id: &'a str,
id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
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. Read more
Source§fn count(
&self,
) -> Pin<Box<dyn Future<Output = Result<Option<usize>, A2aError>> + Send + '_>>
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). Read moreSource§fn isolates_tenants(&self) -> bool
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.Auto Trait Implementations§
impl !RefUnwindSafe for SqlitePushConfigStore
impl !UnwindSafe for SqlitePushConfigStore
impl Forget for SqlitePushConfigStore
impl Freeze for SqlitePushConfigStore
impl Move for SqlitePushConfigStore
impl Send for SqlitePushConfigStore
impl Sync for SqlitePushConfigStore
impl Unpin for SqlitePushConfigStore
impl UnsafeUnpin for SqlitePushConfigStore
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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> ⓘ
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 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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].