pub trait Source: Send {
// Required methods
fn poll(&mut self, out: &mut Out) -> Poll;
fn on_barrier(&mut self, epoch: u64) -> Vec<u8> ⓘ;
// Provided methods
fn position(&mut self) -> Vec<u8> ⓘ { ... }
fn on_commit(&mut self, _epoch: u64) { ... }
fn on_stop(&mut self) { ... }
}Expand description
A source drives itself: the runtime calls poll until it returns Poll::Done (or the
coordinator stops it).
Required Methods§
fn poll(&mut self, out: &mut Out) -> Poll
Sourcefn on_barrier(&mut self, epoch: u64) -> Vec<u8> ⓘ
fn on_barrier(&mut self, epoch: u64) -> Vec<u8> ⓘ
A barrier for epoch: record the position the epoch covers; the bytes are the source’s
own record of it, opaque to the runtime (a single-partition source writes it with
position_record, the shape the checkpoint reads back).
Provided Methods§
Sourcefn position(&mut self) -> Vec<u8> ⓘ
fn position(&mut self) -> Vec<u8> ⓘ
The position now, in the record on_barrier writes — read once when the source runs dry,
so every checkpoint taken after it still names where it ended (a restore then resumes it
there, past everything it emitted, instead of replaying it from the start). An unbounded
source never runs dry: the default records nothing.
Trait Implementations§
Source§impl Source for Box<dyn Source>
impl Source for Box<dyn Source>
fn poll(&mut self, out: &mut Out) -> Poll
Source§fn on_barrier(&mut self, epoch: u64) -> Vec<u8> ⓘ
fn on_barrier(&mut self, epoch: u64) -> Vec<u8> ⓘ
A barrier for
epoch: record the position the epoch covers; the bytes are the source’s
own record of it, opaque to the runtime (a single-partition source writes it with
position_record, the shape the checkpoint reads back).Source§fn position(&mut self) -> Vec<u8> ⓘ
fn position(&mut self) -> Vec<u8> ⓘ
The position now, in the record
on_barrier writes — read once when the source runs dry,
so every checkpoint taken after it still names where it ended (a restore then resumes it
there, past everything it emitted, instead of replaying it from the start). An unbounded
source never runs dry: the default records nothing.Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".