Trait mz_adapter::TimestampProvider
source · pub trait TimestampProvider {
// Required methods
fn compute_read_frontier(
&self,
instance: ComputeInstanceId,
id: GlobalId,
) -> Antichain<Timestamp>;
fn compute_write_frontier(
&self,
instance: ComputeInstanceId,
id: GlobalId,
) -> Antichain<Timestamp>;
fn storage_frontiers(
&self,
ids: Vec<GlobalId>,
) -> Vec<(GlobalId, Antichain<Timestamp>, Antichain<Timestamp>)>;
fn catalog_state(&self) -> &CatalogState;
fn acquire_read_holds(
&self,
id_bundle: &CollectionIdBundle,
) -> ReadHolds<Timestamp>;
// Provided methods
fn get_timeline(timeline_context: &TimelineContext) -> Option<Timeline> { ... }
fn needs_linearized_read_ts(
isolation_level: &IsolationLevel,
when: &QueryWhen,
) -> bool { ... }
fn determine_timestamp_for(
&self,
session: &Session,
id_bundle: &CollectionIdBundle,
when: &QueryWhen,
compute_instance: ComputeInstanceId,
timeline_context: &TimelineContext,
oracle_read_ts: Option<Timestamp>,
real_time_recency_ts: Option<Timestamp>,
isolation_level: &IsolationLevel,
) -> Result<(TimestampDetermination<Timestamp>, ReadHolds<Timestamp>), AdapterError> { ... }
fn least_valid_read(
&self,
read_holds: &ReadHolds<Timestamp>,
) -> Antichain<Timestamp> { ... }
fn least_valid_write(
&self,
id_bundle: &CollectionIdBundle,
) -> Antichain<Timestamp> { ... }
fn greatest_available_read(
&self,
id_bundle: &CollectionIdBundle,
) -> Antichain<Timestamp> { ... }
}
Required Methods§
fn compute_read_frontier( &self, instance: ComputeInstanceId, id: GlobalId, ) -> Antichain<Timestamp>
fn compute_write_frontier( &self, instance: ComputeInstanceId, id: GlobalId, ) -> Antichain<Timestamp>
sourcefn storage_frontiers(
&self,
ids: Vec<GlobalId>,
) -> Vec<(GlobalId, Antichain<Timestamp>, Antichain<Timestamp>)>
fn storage_frontiers( &self, ids: Vec<GlobalId>, ) -> Vec<(GlobalId, Antichain<Timestamp>, Antichain<Timestamp>)>
Returns the implied capability (since) and write frontier (upper) for the specified storage collections.
fn catalog_state(&self) -> &CatalogState
sourcefn acquire_read_holds(
&self,
id_bundle: &CollectionIdBundle,
) -> ReadHolds<Timestamp>
fn acquire_read_holds( &self, id_bundle: &CollectionIdBundle, ) -> ReadHolds<Timestamp>
Acquires ReadHolds, for the given id_bundle
at the earliest possible
times.
Provided Methods§
fn get_timeline(timeline_context: &TimelineContext) -> Option<Timeline>
sourcefn needs_linearized_read_ts(
isolation_level: &IsolationLevel,
when: &QueryWhen,
) -> bool
fn needs_linearized_read_ts( isolation_level: &IsolationLevel, when: &QueryWhen, ) -> bool
Returns true if-and-only-if the given configuration needs a linearized read timetamp from a timestamp oracle.
This assumes that the query happens in the context of a timeline. If there is no timeline, we cannot and don’t have to get a linearized read timestamp.
sourcefn determine_timestamp_for(
&self,
session: &Session,
id_bundle: &CollectionIdBundle,
when: &QueryWhen,
compute_instance: ComputeInstanceId,
timeline_context: &TimelineContext,
oracle_read_ts: Option<Timestamp>,
real_time_recency_ts: Option<Timestamp>,
isolation_level: &IsolationLevel,
) -> Result<(TimestampDetermination<Timestamp>, ReadHolds<Timestamp>), AdapterError>
fn determine_timestamp_for( &self, session: &Session, id_bundle: &CollectionIdBundle, when: &QueryWhen, compute_instance: ComputeInstanceId, timeline_context: &TimelineContext, oracle_read_ts: Option<Timestamp>, real_time_recency_ts: Option<Timestamp>, isolation_level: &IsolationLevel, ) -> Result<(TimestampDetermination<Timestamp>, ReadHolds<Timestamp>), AdapterError>
Determines the timestamp for a query.
Timestamp determination may fail due to the restricted validity of
traces. Each has a since
and upper
frontier, and are only valid
after since
and sure to be available not after upper
.
The timeline that id_bundle
belongs to is also returned, if one exists.
sourcefn least_valid_read(
&self,
read_holds: &ReadHolds<Timestamp>,
) -> Antichain<Timestamp>
fn least_valid_read( &self, read_holds: &ReadHolds<Timestamp>, ) -> Antichain<Timestamp>
The smallest common valid read frontier among times in the given ReadHolds.
sourcefn least_valid_write(
&self,
id_bundle: &CollectionIdBundle,
) -> Antichain<Timestamp>
fn least_valid_write( &self, id_bundle: &CollectionIdBundle, ) -> Antichain<Timestamp>
The smallest common valid write frontier among the specified collections.
Times that are not greater or equal to this frontier are complete for all collections identified as arguments.
sourcefn greatest_available_read(
&self,
id_bundle: &CollectionIdBundle,
) -> Antichain<Timestamp>
fn greatest_available_read( &self, id_bundle: &CollectionIdBundle, ) -> Antichain<Timestamp>
Returns least_valid_write
- 1, i.e., each time in least_valid_write
stepped back in a
saturating way.