Skip to main content

LogSource

Trait LogSource 

Source
pub trait LogSource: Send + Sync {
    // Required methods
    fn head(&self) -> Result<(u64, u64)>;
    fn fetch(&self, from: u64, to: u64, max_bytes: u64) -> Result<Vec<Entry>>;

    // Provided methods
    fn alternatives(&self) -> bool { ... }
    fn head_and_identity(&self) -> Result<(u64, u64, Option<String>)> { ... }
    fn head_identity_generation(
        &self,
    ) -> Result<(u64, u64, Option<String>, u64)> { ... }
    fn fetch_into(
        &self,
        from: u64,
        to: u64,
        max_bytes: u64,
        into: &mut dyn FrameSink,
    ) -> Result<()> { ... }
    fn snapshot(&self, _into: &mut Stager) -> Result<bool> { ... }
}
Expand description

What the twin reads from: LogHead and LogFetch, over gRPC in the appliance and over a shared Log in tests and in restore.

Required Methods§

Source

fn head(&self) -> Result<(u64, u64)>

(first_seq, head_seq) on the primary.

Source

fn fetch(&self, from: u64, to: u64, max_bytes: u64) -> Result<Vec<Entry>>

Entries from..=to, at most about max_bytes of blob, never fewer than one when from <= to.

Provided Methods§

Source

fn alternatives(&self) -> bool

Does the primary have another address to re-dial when this one keeps failing? (The tunnel’s and the utility network’s.) In-process sources have none.

Source

fn head_and_identity(&self) -> Result<(u64, u64, Option<String>)>

(first_seq, head_seq, the source's log identity) — one call, because the identity has to come from the SAME answer as the numbers it qualifies. Asking twice would leave a window in which the numbers are one box’s and the name is another’s, which is the bug in a nicer shape.

The default carries no identity, and that is the truthful answer for every in-process source: a bare Arc<Log>, a LocalSource over another data root in this process, a test’s script. Nothing was fetched over a wire, so there is nothing to have been lied to about. Only GrpcSource overrides it. See LOG_ID.

Source

fn head_identity_generation(&self) -> Result<(u64, u64, Option<String>, u64)>

LogSource::head_and_identity and the source’s GENERATION (LOG_GENERATION), out of the same answer. 0 = none claimed: every in-process source, and a primary never restored or older than the field.

Source

fn fetch_into( &self, from: u64, to: u64, max_bytes: u64, into: &mut dyn FrameSink, ) -> Result<()>

LogSource::fetch, streamed into into — what the follower calls (twin-streaming, 2026-10-06). Every source that reads a real log overrides it (GrpcSource off the wire, a bare Arc<Log> and LocalSource off the segments), so an entry is never whole in memory however large it is. The default gathers through fetch and hands each blob over as one piece: right for a scripted source, whose entries are already in its hands.

Source

fn snapshot(&self, _into: &mut Stager) -> Result<bool>

A consistent snapshot of the source’s stores, for a twin behind a retention hole, fed piece by piece into the twin’s staging area as it arrives. false = this source cannot make one (a bare log): the twin stops with snapshot-needed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl LogSource for Arc<Log>

Source§

fn head(&self) -> Result<(u64, u64)>

Source§

fn fetch(&self, from: u64, to: u64, max_bytes: u64) -> Result<Vec<Entry>>

Source§

fn fetch_into( &self, from: u64, to: u64, max_bytes: u64, into: &mut dyn FrameSink, ) -> Result<()>

Implementors§