pub struct PostgresPushConfigStore { /* private fields */ }postgres only.Expand description
PostgreSQL-backed PushConfigStore.
Stores push notification configs as JSONB 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 JSONB NOT NULL,
PRIMARY KEY (task_id, id)
);Implementations§
Source§impl PostgresPushConfigStore
impl PostgresPushConfigStore
Sourcepub async fn new(url: &str) -> Result<PostgresPushConfigStore, Error>
pub async fn new(url: &str) -> Result<PostgresPushConfigStore, Error>
Opens a PostgreSQL connection pool and initializes the schema.
§Errors
Returns an error if the database cannot be opened or the schema migration fails.
Sourcepub async fn new_with_pool_size(
url: &str,
size: u32,
) -> Result<PostgresPushConfigStore, Error>
pub async fn new_with_pool_size( url: &str, size: u32, ) -> Result<PostgresPushConfigStore, Error>
new, with a pool of size connections instead of
DEFAULT_POOL_SIZE (10); zero is
read as one. The size is logged at INFO (feature tracing).
Every replica opens its own pools, so the sum of every pool size in a
replica, times the replicas (and a surge pod during a rollout), must
stay under the server’s max_connections: 100 by default, 3 of them
reserved for superusers (audit E-F6, D-17). The book’s Running More
Than One Replica gives the arithmetic.
§Errors
Returns an error if the database cannot be opened or the schema migration fails.
Sourcepub fn with_cipher(
self,
cipher: Arc<dyn PushConfigCipher>,
) -> PostgresPushConfigStore
pub fn with_cipher( self, cipher: Arc<dyn PushConfigCipher>, ) -> PostgresPushConfigStore
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) -> PostgresPushConfigStore
pub fn accept_unsealed_rows(self) -> PostgresPushConfigStore
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<Postgres>,
) -> Result<PostgresPushConfigStore, Error>
pub async fn from_pool( pool: Pool<Postgres>, ) -> Result<PostgresPushConfigStore, Error>
Creates a store from an existing connection pool.
§Errors
Returns an error if the schema migration fails.
Trait Implementations§
Source§impl Clone for PostgresPushConfigStore
impl Clone for PostgresPushConfigStore
Source§fn clone(&self) -> PostgresPushConfigStore
fn clone(&self) -> PostgresPushConfigStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PostgresPushConfigStore
impl Debug for PostgresPushConfigStore
Source§impl PushConfigStore for PostgresPushConfigStore
impl PushConfigStore for PostgresPushConfigStore
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>>
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>>
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>>
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>>
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 + '_>>
None if this backend does not report a
count (in which case only the per-task cap is enforced). Read moreSource§fn is_process_local(&self) -> bool
fn is_process_local(&self) -> bool
Source§fn isolates_tenants(&self) -> bool
fn isolates_tenants(&self) -> bool
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 PostgresPushConfigStore
impl !UnwindSafe for PostgresPushConfigStore
impl Forget for PostgresPushConfigStore
impl Freeze for PostgresPushConfigStore
impl Move for PostgresPushConfigStore
impl Send for PostgresPushConfigStore
impl Sync for PostgresPushConfigStore
impl Unpin for PostgresPushConfigStore
impl UnsafeUnpin for PostgresPushConfigStore
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
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
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>,
Layered].