pub struct CloudFrontInvalidator { /* private fields */ }Expand description
CloudFront-backed page-cache invalidator. Holds the resolved
SDK client + the target distribution id. Built via
Self::from_env_distribution (recommended) or
Self::with_client for tests / hand-rolled config.
Implementations§
Source§impl CloudFrontInvalidator
impl CloudFrontInvalidator
Sourcepub async fn from_env_distribution(distribution_id: impl Into<String>) -> Self
pub async fn from_env_distribution(distribution_id: impl Into<String>) -> Self
Resolve AWS credentials from the standard provider chain
(env vars → shared credentials file → IMDS / IRSA) and
build a CloudFront client targeting distribution_id.
async because the credential chain does network I/O on
EC2 / EKS to fetch instance / pod credentials. Call once
at boot, share the resulting Arc<CloudFrontInvalidator>
across the admin router.
Sourcepub fn with_client(distribution_id: impl Into<String>, client: Client) -> Self
pub fn with_client(distribution_id: impl Into<String>, client: Client) -> Self
Build an invalidator from a pre-configured SDK client. Use
when the host already loaded an aws_config::SdkConfig for
other AWS calls and wants to reuse it. Tests use this with
a mock client.
Trait Implementations§
Source§impl PageCacheInvalidator for CloudFrontInvalidator
impl PageCacheInvalidator for CloudFrontInvalidator
Source§fn invalidate_url<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invalidate_url<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
url_path on
the given tenant (slug and org id, as the page cache keys it).
Hosts pass the unprefixed page URL — the implementation appends
the configured URL prefix + host(s) before computing the cache key.Source§fn invalidate_subtree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invalidate_subtree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
url_path /
(the page itself + every descendant). Called after a slug
rename, a move, or a subtree delete.Source§fn invalidate_urls<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_paths: &'life2 [String],
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invalidate_urls<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_paths: &'life2 [String],
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self::invalidate_url — preserving the
per-URL behavior — but backends with a bulk-purge API
(Cloudflare files, Azure CDN contentPaths) should override
this to issue a single request instead of N. The purge fan-out
in crate::task_queue::purge_urls calls this so a batch
backend collapses a multi-URL save into one round-trip.Auto Trait Implementations§
impl !RefUnwindSafe for CloudFrontInvalidator
impl !UnwindSafe for CloudFrontInvalidator
impl Forget for CloudFrontInvalidator
impl Freeze for CloudFrontInvalidator
impl Send for CloudFrontInvalidator
impl Sync for CloudFrontInvalidator
impl Unpin for CloudFrontInvalidator
impl UnsafeUnpin for CloudFrontInvalidator
Blanket Implementations§
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> 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