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§
Provided Methods§
Sourcefn alternatives(&self) -> bool
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.
Sourcefn head_and_identity(&self) -> Result<(u64, u64, Option<String>)>
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.
Sourcefn head_identity_generation(&self) -> Result<(u64, u64, Option<String>, u64)>
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.
Sourcefn fetch_into(
&self,
from: u64,
to: u64,
max_bytes: u64,
into: &mut dyn FrameSink,
) -> Result<()>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".