pub struct CheckpointState {
pub id: CheckpointId,
pub operator_states: HashMap<String, Vec<u8>>,
pub source_offsets: HashMap<String, u64>,
pub watermark_ns: u64,
pub event_count: u64,
pub metadata: HashMap<String, String>,
}Expand description
Serialisable snapshot captured at a checkpoint.
§Binary format
[8 bytes] sequence (little-endian u64)
[8 bytes] watermark_ns (little-endian u64)
[8 bytes] event_count (little-endian u64)
[4 bytes] n_operators (little-endian u32)
for each operator:
[4 bytes] name_len (little-endian u32)
[name_len bytes] name (UTF-8)
[4 bytes] state_len (little-endian u32)
[state_len bytes] state (opaque bytes)
[4 bytes] n_sources (little-endian u32)
for each source:
[4 bytes] name_len (little-endian u32)
[name_len bytes] name (UTF-8)
[8 bytes] offset (little-endian u64)Fields§
§id: CheckpointIdIdentity of this checkpoint.
operator_states: HashMap<String, Vec<u8>>Per-operator opaque state blobs. Key: operator name.
source_offsets: HashMap<String, u64>Per-source byte/record offsets. Key: source identifier.
watermark_ns: u64Maximum processed event time expressed as nanoseconds since the Unix epoch.
event_count: u64Number of events processed up to and including this checkpoint.
metadata: HashMap<String, String>Arbitrary key→value metadata.
Implementations§
Source§impl CheckpointState
impl CheckpointState
Sourcepub fn new(id: CheckpointId) -> Self
pub fn new(id: CheckpointId) -> Self
Create an empty state for the given checkpoint ID.
Sourcepub fn set_operator_state(
&mut self,
operator: impl Into<String>,
state: Vec<u8>,
)
pub fn set_operator_state( &mut self, operator: impl Into<String>, state: Vec<u8>, )
Store an operator’s serialised state.
Sourcepub fn set_source_offset(&mut self, source: impl Into<String>, offset: u64)
pub fn set_source_offset(&mut self, source: impl Into<String>, offset: u64)
Record the byte/record offset for a source.
Sourcepub fn deserialize(stream_id: &str, data: &[u8]) -> Result<Self, StreamingError>
pub fn deserialize(stream_id: &str, data: &[u8]) -> Result<Self, StreamingError>
Deserialise a CheckpointState from bytes previously produced by Self::serialize.
Returns StreamingError::DeserializationError if the data is truncated
or otherwise malformed.
Trait Implementations§
Source§impl Clone for CheckpointState
impl Clone for CheckpointState
Source§fn clone(&self) -> CheckpointState
fn clone(&self) -> CheckpointState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CheckpointState
impl RefUnwindSafe for CheckpointState
impl Send for CheckpointState
impl Sync for CheckpointState
impl Unpin for CheckpointState
impl UnsafeUnpin for CheckpointState
impl UnwindSafe for CheckpointState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more