Checkpointer

Struct Checkpointer 

Source
pub struct Checkpointer<'a, W: OutputWriter, R: InputReader> { /* private fields */ }

Implementations§

Source§

impl<'a, W: OutputWriter, R: InputReader> Checkpointer<'a, W, R>

Source

pub fn checkpoint( &mut self, sequence_number: Option<String>, sub_sequence_number: Option<u64>, ) -> Result<(), CheckpointError>

Checkpoints at a particular sequence number you provide or if no sequence number is given, the checkpoint will be at the end of the most recently delivered list of records.

§Arguments
  • sequence_number: the sequence number to checkpoint
  • sub_sequence_number: the sub sequence number generated by KPL

returns: Result<(), Report>

Examples found in repository?
examples/example_consumer/main.rs (line 29)
17    fn process_records(
18        &mut self,
19        data: &[Record],
20        checkpointer: &mut Checkpointer<StdoutWriter, StdinReader>,
21    ) {
22        for record in data {
23            match record.json::<MyPayload>() {
24                Ok(data) => println!("{:?}", data.event_field),
25                Err(e) => println!("{:?}", e),
26            }
27        }
28        checkpointer
29            .checkpoint(None, None)
30            .expect("Checkpoint to succeed.");
31    }
32    fn lease_lost(&mut self) {}
33    fn shard_ended(&mut self, checkpointer: &mut Checkpointer<StdoutWriter, StdinReader>) {
34        checkpointer
35            .checkpoint(None, None)
36            .expect("Checkpoint to succeed.");
37    }
38    fn shutdown_requested(&mut self, checkpointer: &mut Checkpointer<StdoutWriter, StdinReader>) {
39        checkpointer
40            .checkpoint(None, None)
41            .expect("Checkpoint to succeed.");
42    }

Auto Trait Implementations§

§

impl<'a, W, R> Freeze for Checkpointer<'a, W, R>

§

impl<'a, W, R> RefUnwindSafe for Checkpointer<'a, W, R>

§

impl<'a, W, R> Send for Checkpointer<'a, W, R>
where W: Send, R: Send,

§

impl<'a, W, R> Sync for Checkpointer<'a, W, R>
where W: Sync, R: Sync,

§

impl<'a, W, R> Unpin for Checkpointer<'a, W, R>

§

impl<'a, W, R> !UnwindSafe for Checkpointer<'a, W, R>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.