pub struct AtomicHttpBackend { /* private fields */ }Expand description
HTTP backend that promises CAS — only constructible when the
operator confirmed the upstream server honors RFC 7232
preconditions (If-Match / If-None-Match).
Wrapping HttpBackend rather than mutating it keeps the snapshot-
transport surface (download/upload/delete) callable on servers that
don’t support CAS, while still preventing LeaseStore from binding
to a non-CAS HTTP server (the type system rejects it at compile).
Implementations§
Source§impl AtomicHttpBackend
impl AtomicHttpBackend
Sourcepub fn try_new(config: HttpBackendConfig) -> Result<Self, BackendError>
pub fn try_new(config: HttpBackendConfig) -> Result<Self, BackendError>
Build a CAS-capable HTTP backend. Returns BackendError::Config
when config.conditional_writes is false — operators must
explicitly opt in via RED_HTTP_CONDITIONAL_WRITES=true after
confirming their server supports preconditions.
pub fn inner(&self) -> &HttpBackend
Trait Implementations§
Source§impl AtomicRemoteBackend for AtomicHttpBackend
impl AtomicRemoteBackend for AtomicHttpBackend
Source§fn object_version(
&self,
remote_key: &str,
) -> Result<Option<BackendObjectVersion>, BackendError>
fn object_version( &self, remote_key: &str, ) -> Result<Option<BackendObjectVersion>, BackendError>
Return the current opaque version token for an object.
Ok(None) means the object does not exist.Source§fn upload_conditional(
&self,
local_path: &Path,
remote_key: &str,
condition: ConditionalPut,
) -> Result<BackendObjectVersion, BackendError>
fn upload_conditional( &self, local_path: &Path, remote_key: &str, condition: ConditionalPut, ) -> Result<BackendObjectVersion, BackendError>
Upload a local file only if the backend-side condition still
holds. Returns the new version token on success;
BackendError::PreconditionFailed on contention.Source§fn delete_conditional(
&self,
remote_key: &str,
condition: ConditionalDelete,
) -> Result<(), BackendError>
fn delete_conditional( &self, remote_key: &str, condition: ConditionalDelete, ) -> Result<(), BackendError>
Delete a remote object only if the backend-side condition
still holds.
BackendError::PreconditionFailed on contention.Source§impl RemoteBackend for AtomicHttpBackend
impl RemoteBackend for AtomicHttpBackend
Source§fn download(
&self,
remote_key: &str,
local_path: &Path,
) -> Result<bool, BackendError>
fn download( &self, remote_key: &str, local_path: &Path, ) -> Result<bool, BackendError>
Download a remote object to a local file path.
Returns
Ok(true) if downloaded, Ok(false) if remote object doesn’t exist.Source§fn upload(
&self,
local_path: &Path,
remote_key: &str,
) -> Result<(), BackendError>
fn upload( &self, local_path: &Path, remote_key: &str, ) -> Result<(), BackendError>
Upload a local file to remote storage.
Source§fn exists(&self, remote_key: &str) -> Result<bool, BackendError>
fn exists(&self, remote_key: &str) -> Result<bool, BackendError>
Check if a remote object exists.
Auto Trait Implementations§
impl Forget for AtomicHttpBackend
impl Freeze for AtomicHttpBackend
impl Move for AtomicHttpBackend
impl RefUnwindSafe for AtomicHttpBackend
impl Send for AtomicHttpBackendwhere
RawVecInner: Send,
impl Sync for AtomicHttpBackendwhere
RawVecInner: Sync,
impl Unpin for AtomicHttpBackend
impl UnsafeUnpin for AtomicHttpBackend
impl UnwindSafe for AtomicHttpBackendwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request