pub trait RpcStateReader:
ReadStore
+ RuntimeObjectResolver
+ Send
+ Sync {
// Required methods
fn get_lowest_available_checkpoint_objects(
&self,
) -> Result<CheckpointSequenceNumber>;
fn get_chain_identifier(&self) -> Result<ChainIdentifier>;
fn indexes(&self) -> Option<&dyn RpcIndexes>;
// Provided methods
fn retains_object_version_history(&self) -> bool { ... }
fn get_lowest_checkpoint_with_index_history(
&self,
) -> Result<CheckpointSequenceNumber> { ... }
fn get_object_lt_or_eq_version(
&self,
_object_id: &ObjectID,
_version: SequenceNumber,
) -> Result<Option<Object>> { ... }
fn get_latest_object_or_tombstone(
&self,
_object_id: &ObjectID,
) -> Result<Option<ObjectOrTombstone>> { ... }
fn get_object_or_tombstone_lt_or_eq_version(
&self,
object_id: &ObjectID,
version: SequenceNumber,
) -> Result<Option<ObjectOrTombstone>> { ... }
fn get_object_or_tombstone_by_key(
&self,
object_id: &ObjectID,
version: SequenceNumber,
) -> Result<Option<ObjectOrTombstone>> { ... }
fn get_highest_executed_checkpoint_seq_number(
&self,
) -> Result<CheckpointSequenceNumber> { ... }
fn layout_package_store(
&self,
) -> Box<dyn BackingPackageStore + Send + Sync + '_> { ... }
}Expand description
Trait used to provide functionality to the REST API service.
It extends ReadStore and RuntimeObjectResolver by adding functionality that may require more detailed underlying databases or indexes to support.
Required Methods§
Sourcefn get_lowest_available_checkpoint_objects(
&self,
) -> Result<CheckpointSequenceNumber>
fn get_lowest_available_checkpoint_objects( &self, ) -> Result<CheckpointSequenceNumber>
Lowest available checkpoint for which object data can be requested.
Specifically this is the lowest checkpoint for which input/output object data will be available.
fn get_chain_identifier(&self) -> Result<ChainIdentifier>
fn indexes(&self) -> Option<&dyn RpcIndexes>
Provided Methods§
Sourcefn retains_object_version_history(&self) -> bool
fn retains_object_version_history(&self) -> bool
Whether this store keeps an object’s versions after later transactions replace them, up
to Self::get_lowest_available_checkpoint_objects. false on nodes that run the
tidehunter objects compactor, which keeps only each object’s latest version and never
raises that lower bound.
Sourcefn get_lowest_checkpoint_with_index_history(
&self,
) -> Result<CheckpointSequenceNumber>
fn get_lowest_checkpoint_with_index_history( &self, ) -> Result<CheckpointSequenceNumber>
The first checkpoint the rpc indexes have history for.
The indexes record each change made at or above this checkpoint with the checkpoint that made it. Rows a store loads from a live-object snapshot instead (an object’s restore floor, or a package version with no publish checkpoint) hold the state at the end of the checkpoint before this one, with no record of when that state began. So a listing of indexed changes is complete only from this checkpoint, and a read of the indexes as of a checkpoint is exact only from the checkpoint before it.
Defaults to 0, for indexes built from genesis and for a node that backfills index
history down to its lowest available checkpoint: the availability floors already bound
reads there. A store that never backfills, such as a fork seeded at a checkpoint, reports
the first checkpoint it indexed itself.
Sourcefn get_object_lt_or_eq_version(
&self,
_object_id: &ObjectID,
_version: SequenceNumber,
) -> Result<Option<Object>>
fn get_object_lt_or_eq_version( &self, _object_id: &ObjectID, _version: SequenceNumber, ) -> Result<Option<Object>>
The object’s newest version at or below version, like the execution cache’s
find_object_lt_or_eq_version. None if the object has no version at or below
version, or if it was deleted or wrapped at that newest version. On a store whose object
lower bound (Self::get_lowest_available_checkpoint_objects) is above 0, also None
if the version found may be one the store pruned, which readers answer as possibly pruned.
Fails by default. Stores that serve GetObject’s max_version override it, and
GetObject refuses max_version on stores without rpc indexes (Self::indexes) before
reading.
Sourcefn get_latest_object_or_tombstone(
&self,
_object_id: &ObjectID,
) -> Result<Option<ObjectOrTombstone>>
fn get_latest_object_or_tombstone( &self, _object_id: &ObjectID, ) -> Result<Option<ObjectOrTombstone>>
The object’s latest state: its newest version, or the tombstone (see
ObjectOrTombstone) if it was deleted or wrapped there. None if the object has no
version, and always None by default, for stores that cannot tell a removal from absence.
GetObject reads the live object with ObjectStore::get_object first, and this only
when there is none.
Sourcefn get_object_or_tombstone_lt_or_eq_version(
&self,
object_id: &ObjectID,
version: SequenceNumber,
) -> Result<Option<ObjectOrTombstone>>
fn get_object_or_tombstone_lt_or_eq_version( &self, object_id: &ObjectID, version: SequenceNumber, ) -> Result<Option<ObjectOrTombstone>>
Self::get_object_lt_or_eq_version, but the newest version at or below version is
returned as a tombstone if the object was deleted or wrapped there, rather than as
None. It must see the same versions that method does, including those not yet committed
to a store behind a cache, so that both select the same version, and it answers None
for the same entries that may have been pruned. In particular, it never returns a
tombstone that may have a pruned version after it: GetObject answers a read that
resolves to the returned tombstone with that removal. A store without rpc indexes cannot
tell those apart and may return them: GetObject reads it there only for exact version
reads (see Self::get_object_or_tombstone_by_key), keeping only an entry at the
requested version.
Defaults to Self::get_object_lt_or_eq_version, for stores that cannot tell a removal
from absence: a removal reads as None, and a store that serves neither method fails.
Sourcefn get_object_or_tombstone_by_key(
&self,
object_id: &ObjectID,
version: SequenceNumber,
) -> Result<Option<ObjectOrTombstone>>
fn get_object_or_tombstone_by_key( &self, object_id: &ObjectID, version: SequenceNumber, ) -> Result<Option<ObjectOrTombstone>>
Exactly version of the object: the object, or the tombstone if it was deleted or
wrapped at version. None if the object has no entry at version, or if
Self::get_object_or_tombstone_lt_or_eq_version would answer None for the entry at
version as one that may have been pruned.
Defaults to that method’s entry, kept only if it is at version. Stores that check the
entry against their object lower bound override it, so that they check only an entry at
version, never an older one this read discards.
Sourcefn get_highest_executed_checkpoint_seq_number(
&self,
) -> Result<CheckpointSequenceNumber>
fn get_highest_executed_checkpoint_seq_number( &self, ) -> Result<CheckpointSequenceNumber>
The sequence number of the highest executed checkpoint, independent of how far any embedded index has caught up.
ReadStore::get_latest_checkpoint may bound the reported tip to the
live-object index frontier, so clients never observe a checkpoint whose
indexed state is not yet readable. The health check, by contrast, needs
the true executed tip to measure that index lag against, so it reads
this instead. Defaults to
ReadStore::get_latest_checkpoint_sequence_number for backends that
do not bound their reported tip.
Sourcefn layout_package_store(
&self,
) -> Box<dyn BackingPackageStore + Send + Sync + '_>
fn layout_package_store( &self, ) -> Box<dyn BackingPackageStore + Send + Sync + '_>
Returns the package source for response-local layout resolution. Readers whose runtime package store is unavailable or uses a different read policy override this.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".