pub struct TenantAwarePostgresPushConfigStore { /* private fields */ }postgres only.Expand description
Tenant-scoped PostgreSQL-backed PushConfigStore.
Each operation is scoped to the tenant from TenantContext.
With with_cipher, each config is stored sealed
(spec §13.2); see PushConfigCipher.
§Schema
CREATE TABLE IF NOT EXISTS tenant_push_configs (
tenant_id TEXT NOT NULL DEFAULT '',
task_id TEXT NOT NULL,
id TEXT NOT NULL,
data JSONB NOT NULL,
PRIMARY KEY (tenant_id, task_id, id)
);Implementations§
Source§impl TenantAwarePostgresPushConfigStore
impl TenantAwarePostgresPushConfigStore
Sourcepub async fn migrate_caller_keys(
&self,
map: impl Fn(&str) -> Option<String>,
) -> Result<CallerKeyMigration, A2aError>
pub async fn migrate_caller_keys( &self, map: impl Fn(&str) -> Option<String>, ) -> Result<CallerKeyMigration, A2aError>
Moves each caller partition map renames to its new key, in one
transaction (audit register R12); see
caller_keys.
A sealed config’s context names its partition, so each moved config is opened under the old key and sealed again under the new one: run this on the store with its cipher set, as it serves.
§Errors
A database error, a config already stored under the new key, or one this store cannot open; nothing is moved then.
Source§impl TenantAwarePostgresPushConfigStore
impl TenantAwarePostgresPushConfigStore
Sourcepub async fn erase_caller(
&self,
caller: &str,
) -> Result<CallerErasure, A2aError>
pub async fn erase_caller( &self, caller: &str, ) -> Result<CallerErasure, A2aError>
Removes every config of caller, in every tenant, in one
transaction; see
CallerErasure.
§Errors
A database error; nothing is removed then.
Source§impl TenantAwarePostgresPushConfigStore
impl TenantAwarePostgresPushConfigStore
Sourcepub async fn new(url: &str) -> Result<TenantAwarePostgresPushConfigStore, Error>
pub async fn new(url: &str) -> Result<TenantAwarePostgresPushConfigStore, Error>
Opens a PostgreSQL connection pool and initializes the schema.
§Errors
Returns an error if the database cannot be opened or migration fails.
Sourcepub async fn new_with_pool_size(
url: &str,
size: u32,
) -> Result<TenantAwarePostgresPushConfigStore, Error>
pub async fn new_with_pool_size( url: &str, size: u32, ) -> Result<TenantAwarePostgresPushConfigStore, 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>,
) -> TenantAwarePostgresPushConfigStore
pub fn with_cipher( self, cipher: Arc<dyn PushConfigCipher>, ) -> TenantAwarePostgresPushConfigStore
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) -> TenantAwarePostgresPushConfigStore
pub fn accept_unsealed_rows(self) -> TenantAwarePostgresPushConfigStore
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<TenantAwarePostgresPushConfigStore, Error>
pub async fn from_pool( pool: Pool<Postgres>, ) -> Result<TenantAwarePostgresPushConfigStore, Error>
Creates a store from an existing connection pool.
§Errors
Returns an error if the schema migration fails.
Trait Implementations§
Source§impl Clone for TenantAwarePostgresPushConfigStore
impl Clone for TenantAwarePostgresPushConfigStore
Source§fn clone(&self) -> TenantAwarePostgresPushConfigStore
fn clone(&self) -> TenantAwarePostgresPushConfigStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl PushConfigStore for TenantAwarePostgresPushConfigStore
impl PushConfigStore for TenantAwarePostgresPushConfigStore
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.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
Auto Trait Implementations§
impl !RefUnwindSafe for TenantAwarePostgresPushConfigStore
impl !UnwindSafe for TenantAwarePostgresPushConfigStore
impl Forget for TenantAwarePostgresPushConfigStore
impl Freeze for TenantAwarePostgresPushConfigStore
impl Move for TenantAwarePostgresPushConfigStore
impl Send for TenantAwarePostgresPushConfigStore
impl Sync for TenantAwarePostgresPushConfigStore
impl Unpin for TenantAwarePostgresPushConfigStore
impl UnsafeUnpin for TenantAwarePostgresPushConfigStore
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].