pub trait Connection: Send + Sync {
// Required methods
fn committer_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommitterWatermark>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn reader_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
) -> Pin<Box<dyn Future<Output = Result<Option<ReaderWatermark>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_committer_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
watermark: CommitterWatermark,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_reader_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
reader_lo: u64,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pruner_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
delay: Duration,
) -> Pin<Box<dyn Future<Output = Result<Option<PrunerWatermark>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_pruner_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
pruner_hi: u64,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Represents a database connection that can be used by the indexer framework to manage watermark operations, agnostic of the underlying store implementation.
Required Methods§
Sourcefn committer_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommitterWatermark>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn committer_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
) -> Pin<Box<dyn Future<Output = Result<Option<CommitterWatermark>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Given a pipeline, return the committer watermark from the Store
. This is used by the
indexer on startup to determine which checkpoint to resume processing from.
Sourcefn reader_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
) -> Pin<Box<dyn Future<Output = Result<Option<ReaderWatermark>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reader_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
) -> Pin<Box<dyn Future<Output = Result<Option<ReaderWatermark>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Given a pipeline, return the reader watermark from the database. This is used by the indexer
to determine the new reader_lo
or inclusive lower bound of available data.
Sourcefn set_committer_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
watermark: CommitterWatermark,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_committer_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
watermark: CommitterWatermark,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Upsert the high watermark as long as it raises the watermark stored in the database. Returns a boolean indicating whether the watermark was actually updated or not.
Sourcefn set_reader_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
reader_lo: u64,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_reader_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
reader_lo: u64,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update the reader_lo
of an existing watermark entry only if it raises reader_lo
. Readers
will reference this as the inclusive lower bound of available data for the corresponding
pipeline.
If an update is to be made, some timestamp (i.e pruner_timestamp
) should also be set on
the watermark entry to the current time. Ideally, this would be from the perspective of the
store. If this is not possible, then it should come from some other common source of time
between the indexer and its readers. This timestamp is critical to the indexer’s operations,
as it determines when the pruner can safely begin pruning data. When pruner_watermark
is
called by the indexer, it will retrieve this timestamp to determine how much longer to wait
before beginning to prune.
Returns a boolean indicating whether the watermark was actually updated or not.
Sourcefn pruner_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
delay: Duration,
) -> Pin<Box<dyn Future<Output = Result<Option<PrunerWatermark>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pruner_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
delay: Duration,
) -> Pin<Box<dyn Future<Output = Result<Option<PrunerWatermark>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the bounds for the region that the pruner is allowed to prune, and the time in
milliseconds the pruner must wait before it can begin pruning data for the given pipeline
.
The pruner is allowed to prune the region between the returned pruner_hi
(inclusive) and
reader_lo
(exclusive) after waiting until pruner_timestamp + delay
has passed. This
minimizes the possibility for the pruner to delete data still expected by inflight read
requests.
Sourcefn set_pruner_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
pruner_hi: u64,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_pruner_watermark<'life0, 'async_trait>(
&'life0 mut self,
pipeline: &'static str,
pruner_hi: u64,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update the pruner watermark, returns true if the watermark was actually updated