pub struct WalPuller<'a> { /* private fields */ }Expand description
Tails one tenant’s R2 frame stream once per box and fans each newly
pulled frame to every attached WarmApplier. See the module doc for
the full design, the v1 cold-start-only attach scope cut, and the
restart-refusal posture.
Implementations§
Source§impl<'a> WalPuller<'a>
impl<'a> WalPuller<'a>
pub fn new( target: &'a BackupTarget, page_size: usize, cfg: WalPullerConfig, ) -> Self
pub fn page_size(&self) -> usize
pub fn attached_count(&self) -> usize
pub fn disk_used_bytes(&self) -> u64
Sourcepub fn has_pulled(&self) -> bool
pub fn has_pulled(&self) -> bool
true once pull_once() has succeeded at least once — the point
past which attach() refuses (see module doc: v1 does not replay
backlog to a late-joining applier).
Sourcepub fn attach(
&mut self,
name: impl Into<String>,
seam: Box<dyn WarmApplier>,
dest_size_bytes: u64,
) -> Result<()>
pub fn attach( &mut self, name: impl Into<String>, seam: Box<dyn WarmApplier>, dest_size_bytes: u64, ) -> Result<()>
Attach a warm applier: begins its wal_insert session and trims its
page cache to cfg.applier_cache_kb. From this call on it receives
every frame this puller fans out.
dest_size_bytes is the caller’s own estimate of the applier’s
on-disk footprint, counted against cfg.max_disk_bytes — see the
module doc for why this crate takes a hint instead of stat-ing a
file.
Errors if: an applier is already attached under name; the FD
budget (max_appliers) or disk budget (max_disk_bytes) would be
exceeded; or this puller has already completed a pull_once() (v1
scope cut — see module doc).
Sourcepub fn detach(&mut self, name: &str) -> Result<Box<dyn WarmApplier>>
pub fn detach(&mut self, name: &str) -> Result<Box<dyn WarmApplier>>
Detach an applier without promoting it: closes its wal_insert
session (force_commit=false, the same crash-consistent default
restore_latest_stream uses) and returns ownership, freeing its
share of the FD/disk budget.
Sourcepub fn promote(&mut self, name: &str) -> Result<Box<dyn WarmApplier>>
pub fn promote(&mut self, name: &str) -> Result<Box<dyn WarmApplier>>
Promote a warm applier to serve live traffic. Mechanically identical
to Self::detach today (close the session cleanly, hand back the
seam — it is already caught up as of the last pull_once()); kept as
a separate name so call sites read intent, matching §5’s
“Promotable fast → SLA-tier RTO”.
Sourcepub async fn pull_once(&mut self) -> Result<PullReport>
pub async fn pull_once(&mut self) -> Result<PullReport>
Pull every frame newly written since the last call (or since this puller was created) and fan each one out to every attached applier. Each frame is downloaded from the object store once regardless of how many appliers are attached — R2 reads are O(boxes), not O(replicas).
Errors if: the chain’s page_size doesn’t match this puller’s; or
the source’s checkpoint_seq has changed since the last successful
pull (a WAL restart — see module doc, refused rather than patched
over). A missing or wrong-length frame object errors the same way
restore_latest_stream’s replay does.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for WalPuller<'a>
impl<'a> !Send for WalPuller<'a>
impl<'a> !Sync for WalPuller<'a>
impl<'a> !UnwindSafe for WalPuller<'a>
impl<'a> Freeze for WalPuller<'a>
impl<'a> Unpin for WalPuller<'a>
impl<'a> UnsafeUnpin for WalPuller<'a>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
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