Skip to main content

WalPuller

Struct WalPuller 

Source
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>

Source

pub fn new( target: &'a BackupTarget, page_size: usize, cfg: WalPullerConfig, ) -> Self

Source

pub fn page_size(&self) -> usize

Source

pub fn attached_count(&self) -> usize

Source

pub fn disk_used_bytes(&self) -> u64

Source

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).

Source

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).

Source

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.

Source

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”.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more