pub struct CdnService { /* private fields */ }👎Deprecated:
HMAC-signed CDN URLs are not S3-compatible. Use ObjectStorage::presigned_get for real SigV4 URLs.
Expand description
Service for managing CDN URLs for stored files.
§Deprecated
Signs URLs with a raw module-local HMAC scheme, which is not
compatible with S3/MinIO clients and cannot be validated by a
reverse proxy. Use crate::storage::ObjectStorage::presigned_get
instead — it emits real SigV4 URLs for S3/MinIO and signed
module-local URLs for LocalStorage.
Scheduled for removal in a later release (see docs/serving.md).
Implementations§
Source§impl CdnService
impl CdnService
pub fn new( file_repo: Arc<StoredFileRepository>, bucket_repo: Arc<BucketRepository>, ) -> Self
Sourcepub async fn get_or_generate_url(
&self,
file_id: Uuid,
expiry_hours: Option<i64>,
) -> ServiceResult<String>
pub async fn get_or_generate_url( &self, file_id: Uuid, expiry_hours: Option<i64>, ) -> ServiceResult<String>
Get or generate a CDN URL for a file.
If the file already has a valid (non-expired) CDN URL, returns it. Otherwise, generates a new URL and caches it on the file record.
Sourcepub async fn invalidate(&self, _file_id: Uuid) -> ServiceResult<()>
pub async fn invalidate(&self, _file_id: Uuid) -> ServiceResult<()>
Invalidate the cached CDN URL for a file.
Sourcepub async fn invalidate_bucket(&self, _bucket_id: Uuid) -> ServiceResult<u64>
pub async fn invalidate_bucket(&self, _bucket_id: Uuid) -> ServiceResult<u64>
Invalidate all CDN URLs for files in a bucket.
Auto Trait Implementations§
impl !RefUnwindSafe for CdnService
impl !UnwindSafe for CdnService
impl Freeze for CdnService
impl Send for CdnService
impl Sync for CdnService
impl Unpin for CdnService
impl UnsafeUnpin for CdnService
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
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> 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> ⓘ
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 moreCreates a shared type from an unshared type.