pub trait CheckpointStore: Send + Sync {
// Required methods
fn is_persistent(&self) -> bool;
fn stage_checkpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source_id: &'life1 str,
sequence: u64,
source_position: Option<&'life2 Bytes>,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn read_checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
source_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SourceCheckpoint>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_all_checkpoints<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, SourceCheckpoint>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear_checkpoints<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn write_config_hash<'life0, 'async_trait>(
&'life0 self,
hash: u64,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_config_hash<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Atomic checkpoint persistence for source sequence tracking and config hashing.
§Method semantics
stage_checkpointSHOULD be called betweenSessionControl::beginandSessionControl::commitfor persistent backends. The write is staged into the active session transaction and persisted by the outer commit. For volatile (in-memory) backends, it applies immediately.- All other methods operate independently of the session transaction and commit on their own.
§Source positions
Each source feeding a query has its own checkpoint entry. The opaque
source_position bytes allow native stream resumption — on restart, the
query reads each source’s position and passes it via resume_from.
Required Methods§
Sourcefn is_persistent(&self) -> bool
fn is_persistent(&self) -> bool
Whether this store persists checkpoints across process restarts.
The orchestration layer uses this to decide whether to propagate
resume_from and last_sequence to sources on restart. Volatile
(in-memory) stores return false; persistent stores (RocksDB, Garnet)
return true.
Sourcefn stage_checkpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source_id: &'life1 str,
sequence: u64,
source_position: Option<&'life2 Bytes>,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stage_checkpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source_id: &'life1 str,
sequence: u64,
source_position: Option<&'life2 Bytes>,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stage a source checkpoint into the active session transaction.
For persistent backends, must be called inside an open session (between
SessionControl::begin and SessionControl::commit). Returns an error
if no session is active.
For volatile backends (in-memory), applies immediately.
Sourcefn read_checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
source_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SourceCheckpoint>, IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_checkpoint<'life0, 'life1, 'async_trait>(
&'life0 self,
source_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SourceCheckpoint>, IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read the committed checkpoint for a single source.
Returns None if no checkpoint has been written for source_id.
Reads committed state directly; does not require an active session.
Sourcefn read_all_checkpoints<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, SourceCheckpoint>, IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_all_checkpoints<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, SourceCheckpoint>, IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read all committed source checkpoints, keyed by source id.
Returns an empty map if no checkpoints have been written. Reads committed state directly; does not require an active session.
Sourcefn clear_checkpoints<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_checkpoints<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete all source checkpoints and the config hash.
Used during auto-reset recovery and delete_query(cleanup: true).
Standalone commit; not part of any outer session transaction.
Sourcefn write_config_hash<'life0, 'async_trait>(
&'life0 self,
hash: u64,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_config_hash<'life0, 'async_trait>(
&'life0 self,
hash: u64,
) -> Pin<Box<dyn Future<Output = Result<(), IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Write the query config hash.
Used at startup to detect query configuration changes that require a full re-bootstrap. Standalone commit.
Sourcefn read_config_hash<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_config_hash<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, IndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read the stored config hash.
Returns None if no hash has been written. Called at startup before
any session transaction begins.