pub struct S3SnapshotStore { /* private fields */ }Expand description
Bytes live in an opendal-managed S3 bucket under {prefix}/group-{gid}/.
Implementations§
Source§impl S3SnapshotStore
impl S3SnapshotStore
pub fn new(operator: Operator, prefix: impl Into<String>) -> Self
pub fn with_references(self, references: SnapshotReferenceConfig) -> Self
Sourcepub fn memory_for_tests(
prefix: impl Into<String>,
) -> Result<Self, SnapshotStoreError>
pub fn memory_for_tests( prefix: impl Into<String>, ) -> Result<Self, SnapshotStoreError>
In-memory opendal operator under prefix, for tests.
Sourcepub fn try_new(
config: &ColdConfig,
prefix: impl Into<String>,
) -> Result<Self, SnapshotStoreError>
pub fn try_new( config: &ColdConfig, prefix: impl Into<String>, ) -> Result<Self, SnapshotStoreError>
Build an S3 snapshot store from a [ColdConfig].
Snapshot blobs share the cold bucket/credentials and use prefix
(defaults to snapshots) for separation.
Trait Implementations§
Source§impl Debug for S3SnapshotStore
impl Debug for S3SnapshotStore
Source§impl SnapshotStore for S3SnapshotStore
impl SnapshotStore for S3SnapshotStore
Source§fn upload<'a>(
&'a self,
key: SnapshotKey,
bytes: Bytes,
) -> SnapshotStoreFuture<'a, SnapshotLocation>
fn upload<'a>( &'a self, key: SnapshotKey, bytes: Bytes, ) -> SnapshotStoreFuture<'a, SnapshotLocation>
Persist a snapshot blob and return its location. Stores own naming and
MAY ignore parts of
key (Inline does).Source§fn upload_iter<'a>(
&'a self,
key: SnapshotKey,
chunks: SnapshotBytesIterator,
) -> SnapshotStoreFuture<'a, SnapshotLocation>
fn upload_iter<'a>( &'a self, key: SnapshotKey, chunks: SnapshotBytesIterator, ) -> SnapshotStoreFuture<'a, SnapshotLocation>
Persist snapshot bytes from an incremental producer.
Source§fn download<'a>(
&'a self,
location: &'a SnapshotLocation,
) -> SnapshotStoreFuture<'a, Vec<u8>>
fn download<'a>( &'a self, location: &'a SnapshotLocation, ) -> SnapshotStoreFuture<'a, Vec<u8>>
Retrieve a snapshot blob given its location.
Source§fn delete<'a>(
&'a self,
location: &'a SnapshotLocation,
) -> SnapshotStoreFuture<'a, ()>
fn delete<'a>( &'a self, location: &'a SnapshotLocation, ) -> SnapshotStoreFuture<'a, ()>
Best-effort delete; missing is not an error.
Source§fn prune_retired<'a>(
&'a self,
raft_group_id: u32,
current: &'a SnapshotLocation,
retain_latest: usize,
) -> SnapshotStoreFuture<'a, ()>
fn prune_retired<'a>( &'a self, raft_group_id: u32, current: &'a SnapshotLocation, retain_latest: usize, ) -> SnapshotStoreFuture<'a, ()>
Best-effort prune of retired snapshots for one Raft group. Backends may
only delete objects that cannot still be referenced by an OpenRaft
snapshot pointer. Inline snapshots have no external lifecycle, so the
default is a no-op.
Source§fn publish_reference<'a>(
&'a self,
raft_group_id: u32,
location: &'a SnapshotLocation,
) -> SnapshotStoreFuture<'a, ()>
fn publish_reference<'a>( &'a self, raft_group_id: u32, location: &'a SnapshotLocation, ) -> SnapshotStoreFuture<'a, ()>
Publish this node’s current durable pointer. External stores use these
references to prove that an object is unreachable before deleting it;
callers persist local metadata first and rely on the GC grace period
while publishing the corresponding external reference.
Source§fn verify_uploaded<'a>(
&'a self,
location: &'a SnapshotLocation,
) -> SnapshotStoreFuture<'a, ()>
fn verify_uploaded<'a>( &'a self, location: &'a SnapshotLocation, ) -> SnapshotStoreFuture<'a, ()>
Verify that a freshly-uploaded snapshot is actually retrievable from
the backend. Called immediately after
upload returns Ok, before the
new pointer is published. Catches silent partial-success modes
(multipart upload Init/Part Ok but Complete failed, opendal retry
returning Ok on cached state, etc.) that would otherwise leave
current_snapshot pointing at a 404. Default no-op for backends that
can’t lie about persistence (Inline keeps bytes in the pointer; Local
uses a single fs syscall whose Ok means present). The S3 backend
overrides this with a stat round-trip.Source§fn health_check(&self) -> SnapshotStoreFuture<'_, ()>
fn health_check(&self) -> SnapshotStoreFuture<'_, ()>
Lightweight liveness probe for the backend, used by the snapshot driver
to detect local S3 loss WITHOUT triggering a
build_snapshot (whose
failure openraft treats as fatal). The default is “always healthy”:
in-memory and local-filesystem backends cannot be remotely unavailable.
The S3 backend overrides this with a cheap stat.Auto Trait Implementations§
impl !RefUnwindSafe for S3SnapshotStore
impl !UnwindSafe for S3SnapshotStore
impl Freeze for S3SnapshotStore
impl Send for S3SnapshotStore
impl Sync for S3SnapshotStore
impl Unpin for S3SnapshotStore
impl UnsafeUnpin for S3SnapshotStore
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