pub struct ChangeManager { /* private fields */ }Expand description
Manager for multi-step storage changes, including backends and durable log.
Encapsulates the state and logic for recording changes, advancing their phases,
and performing cleanup on drop. The TieredStorage backend holds an instance
of this manager to use it for its multi-step operations.
Implementations§
Source§impl ChangeManager
impl ChangeManager
Sourcepub fn new(
high_volume: Box<dyn HighVolumeBackend>,
long_term: Box<dyn Backend>,
changelog: Box<dyn ChangeLog>,
) -> Arc<Self>
pub fn new( high_volume: Box<dyn HighVolumeBackend>, long_term: Box<dyn Backend>, changelog: Box<dyn ChangeLog>, ) -> Arc<Self>
Creates a new ChangeManager with the given backends and changelog.
Sourcepub async fn record(self: Arc<Self>, change: Change) -> Result<ChangeGuard>
pub async fn record(self: Arc<Self>, change: Change) -> Result<ChangeGuard>
Records the change to the log and returns a guard.
Generates a unique ChangeId and writes a durable log entry before
returning. The caller may proceed with LT side effects immediately after.
When the ChangeGuard is dropped, a background process is spawned to
clean up any unreferenced objects in LT storage.
Sourcepub async fn recover(self: Arc<Self>) -> Result<()>
pub async fn recover(self: Arc<Self>) -> Result<()>
Scans the changelog for outstanding entries and runs cleanup for each.
Spawn this into a background task at startup to recover from any orphaned objects after a crash. During normal operation, this should return an empty list and have no effect.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChangeManager
impl !RefUnwindSafe for ChangeManager
impl Send for ChangeManager
impl Sync for ChangeManager
impl Unpin for ChangeManager
impl !UnwindSafe for ChangeManager
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
§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>
§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].