Skip to main content

RpcIndexes

Trait RpcIndexes 

Source
pub trait RpcIndexes: Send + Sync {
Show 24 methods // Required methods fn get_epoch_info(&self, epoch: EpochId) -> Result<Option<EpochInfo>>; fn owned_objects_iter( &self, owner: SuiAddress, filter: Option<&OwnedObjectFilter>, cursor: Option<OwnedObjectInfo>, ) -> Result<Box<dyn Iterator<Item = Result<OwnedObjectInfo, TypedStoreError>> + '_>>; fn dynamic_field_iter( &self, parent: ObjectID, filter: Option<&DynamicFieldFilter>, cursor: Option<DynamicFieldKey>, ) -> Result<Box<dyn Iterator<Item = DynamicFieldIteratorItem> + '_>>; fn get_coin_info(&self, coin_type: &StructTag) -> Result<Option<CoinInfo>>; fn get_balance( &self, owner: &SuiAddress, coin_type: &StructTag, ) -> Result<Option<BalanceInfo>>; fn balance_iter( &self, owner: &SuiAddress, cursor: Option<(SuiAddress, StructTag)>, ) -> Result<BalanceIterator<'_>>; fn package_versions_iter( &self, original_id: ObjectID, start_version: u64, end_version_exclusive: u64, descending: bool, ) -> Result<PackageVersionsIterator<'_>>; fn packages_by_checkpoint_iter( &self, lower: Bound<PackagePublishKey>, upper: Bound<PackagePublishKey>, descending: bool, ) -> Result<PackagesByCheckpointIterator<'_>>; fn get_package_version_storage_id( &self, original_id: ObjectID, version: u64, ) -> Result<Option<ObjectID>>; fn get_package_at_checkpoint( &self, original_id: ObjectID, checkpoint: CheckpointSequenceNumber, ) -> Result<Option<(u64, ObjectID)>>; fn get_object_version_at_checkpoint( &self, object_id: ObjectID, checkpoint: CheckpointSequenceNumber, ) -> Result<Option<SequenceNumber>>; fn first_checkpoint_with_object_version( &self, object_id: ObjectID, checkpoints: RangeInclusive<CheckpointSequenceNumber>, ) -> Result<Option<(CheckpointSequenceNumber, SequenceNumber)>>; fn object_versions_iter( &self, object_id: ObjectID, versions: RangeInclusive<SequenceNumber>, descending: bool, ) -> Result<ObjectVersionsIterator<'_>>; fn get_highest_indexed_checkpoint_seq_number( &self, ) -> Result<Option<CheckpointSequenceNumber>>; fn is_history_backfill_pending(&self) -> Result<bool>; fn get_highest_indexed_checkpoint_timestamp_ms(&self) -> Result<Option<u64>>; fn ledger_tx_seq_digest( &self, tx_seq: u64, ) -> Result<Option<LedgerTxSeqDigest>>; fn ledger_tx_seq_by_digest( &self, digest: &TransactionDigest, ) -> Result<Option<u64>>; fn ledger_tx_seq_digest_iter( &self, start: u64, end_exclusive: u64, descending: bool, ) -> Result<LedgerTxSeqDigestIterator<'_>>; fn transaction_bitmap_bucket_iter( &self, dimension_key: Vec<u8>, start_bucket: u64, end_bucket_exclusive: u64, descending: bool, ) -> Result<LedgerBitmapBucketIterator<'_>>; fn event_bitmap_bucket_iter( &self, dimension_key: Vec<u8>, start_bucket: u64, end_bucket_exclusive: u64, descending: bool, ) -> Result<LedgerBitmapBucketIterator<'_>>; // Provided methods fn get_highest_live_indexed_checkpoint_seq_number( &self, ) -> Result<Option<CheckpointSequenceNumber>> { ... } fn get_highest_live_indexed_checkpoint_timestamp_ms( &self, ) -> Result<Option<u64>> { ... } fn ledger_tx_seq_digest_multi_get( &self, tx_seqs: &[u64], ) -> Result<Vec<Option<LedgerTxSeqDigest>>> { ... }
}

Required Methods§

Source

fn get_epoch_info(&self, epoch: EpochId) -> Result<Option<EpochInfo>>

Source

fn owned_objects_iter( &self, owner: SuiAddress, filter: Option<&OwnedObjectFilter>, cursor: Option<OwnedObjectInfo>, ) -> Result<Box<dyn Iterator<Item = Result<OwnedObjectInfo, TypedStoreError>> + '_>>

Iterate the live objects owner owns that filter matches (every object when filter is None), in the order of the owned-object index: by type, then by descending balance for coins, then by object id. cursor resumes the scan at that entry, inclusive.

Source

fn dynamic_field_iter( &self, parent: ObjectID, filter: Option<&DynamicFieldFilter>, cursor: Option<DynamicFieldKey>, ) -> Result<Box<dyn Iterator<Item = DynamicFieldIteratorItem> + '_>>

Iterate the dynamic fields owned by parent that filter matches (every field when filter is None). Dynamic-field objects live in the same owned-object index as address-owned objects (under the object-owner key, sorted by (type, object id)), so the DynamicFieldKey cursor carries the field’s type alongside its id – the full sort position – letting the scan seek straight to it, as in owned_objects_iter.

Source

fn get_coin_info(&self, coin_type: &StructTag) -> Result<Option<CoinInfo>>

Source

fn get_balance( &self, owner: &SuiAddress, coin_type: &StructTag, ) -> Result<Option<BalanceInfo>>

Source

fn balance_iter( &self, owner: &SuiAddress, cursor: Option<(SuiAddress, StructTag)>, ) -> Result<BalanceIterator<'_>>

Source

fn package_versions_iter( &self, original_id: ObjectID, start_version: u64, end_version_exclusive: u64, descending: bool, ) -> Result<PackageVersionsIterator<'_>>

Iterate the versions of the package originally published at original_id in [start_version, end_version_exclusive), in ascending version order, or descending when descending is set. Versions with no recorded publish checkpoint are the lowest, and recorded publish checkpoints are non-decreasing in version, once Self::is_history_backfill_pending is false.

Source

fn packages_by_checkpoint_iter( &self, lower: Bound<PackagePublishKey>, upper: Bound<PackagePublishKey>, descending: bool, ) -> Result<PackagesByCheckpointIterator<'_>>

Iterate the versions of every package whose keys lie between lower and upper, in PackagePublishKey order, or in reverse when descending is set. Each item is a version’s key and the storage id under which the version lives. A range with lower above upper lists nothing.

Only versions with a recorded publish checkpoint are listed (see IndexedPackageVersion::checkpoint), so the versions published at a checkpoint are complete only from where the indexes’ history begins, and once Self::is_history_backfill_pending is false.

Source

fn get_package_version_storage_id( &self, original_id: ObjectID, version: u64, ) -> Result<Option<ObjectID>>

Resolve the storage id holding the exact version of the package originally published at original_id.

Source

fn get_package_at_checkpoint( &self, original_id: ObjectID, checkpoint: CheckpointSequenceNumber, ) -> Result<Option<(u64, ObjectID)>>

Resolve the (version, storage_id) of the latest package in original_id’s upgrade lineage that existed at or before checkpoint.

Source

fn get_object_version_at_checkpoint( &self, object_id: ObjectID, checkpoint: CheckpointSequenceNumber, ) -> Result<Option<SequenceNumber>>

Resolve the version object_id had as of the end of checkpoint: the version recorded by the latest checkpoint at or before checkpoint that changed the object. That version may be a deletion or wrapping tombstone, which has no live object behind it. None if the object did not exist as of checkpoint.

The caller must confirm checkpoint is within the index’s available range, and that Self::is_history_backfill_pending is false; this method assumes both.

Source

fn first_checkpoint_with_object_version( &self, object_id: ObjectID, checkpoints: RangeInclusive<CheckpointSequenceNumber>, ) -> Result<Option<(CheckpointSequenceNumber, SequenceNumber)>>

The first checkpoint in checkpoints at whose end object_id has a version, as Self::get_object_version_at_checkpoint resolves it, with that version. None if it has none by the end of the range. A version at the end of a checkpoint stays at every later one, so this is the range’s start when the object has a version there, and otherwise the first checkpoint in the range that changed the object.

The caller must confirm the range is within the index’s available range, and that Self::is_history_backfill_pending is false; this method assumes both.

Source

fn object_versions_iter( &self, object_id: ObjectID, versions: RangeInclusive<SequenceNumber>, descending: bool, ) -> Result<ObjectVersionsIterator<'_>>

Iterate the versions of object_id within versions, oldest first, or newest first if descending, each a live object or the tombstone marking a version at which the object was deleted or wrapped (an object reference whose digest is crate::digests::ObjectDigest::OBJECT_DIGEST_DELETED or crate::digests::ObjectDigest::OBJECT_DIGEST_WRAPPED).

Only versions at or below the object’s version at the end of a checkpoint the indexes have committed are complete. Below the object’s version at the end of the lowest checkpoint whose object state is intact (see RpcStateReader::get_lowest_available_checkpoint_objects and RpcStateReader::get_lowest_checkpoint_with_index_history), versions are pruned or about to be, and what remains there is no history: callers that read there must tell those versions apart themselves.

Source

fn get_highest_indexed_checkpoint_seq_number( &self, ) -> Result<Option<CheckpointSequenceNumber>>

Source

fn is_history_backfill_pending(&self) -> Result<bool>

Whether a restore left the checkpoint-pinned indexes behind Self::get_object_version_at_checkpoint and Self::get_package_at_checkpoint still backfilling history below the restore checkpoint. While it has, those reads can be wrong at any checkpoint the indexes cover, not just above the indexed tip, or the indexed tip lies far below the restored live state, so callers must not serve them.

Source

fn get_highest_indexed_checkpoint_timestamp_ms(&self) -> Result<Option<u64>>

The chain timestamp, in milliseconds, of the checkpoint at Self::get_highest_indexed_checkpoint_seq_number, or None while any index pipeline has no watermark yet. Some(0) means a watermark was written without a timestamp (e.g. a restore anchor that only records its checkpoint), so the time is unknown.

Source

fn ledger_tx_seq_digest(&self, tx_seq: u64) -> Result<Option<LedgerTxSeqDigest>>

Source

fn ledger_tx_seq_by_digest( &self, digest: &TransactionDigest, ) -> Result<Option<u64>>

The sequence number of transaction digest, or None if the indexes have not committed it or it is pruned.

Source

fn ledger_tx_seq_digest_iter( &self, start: u64, end_exclusive: u64, descending: bool, ) -> Result<LedgerTxSeqDigestIterator<'_>>

Source

fn transaction_bitmap_bucket_iter( &self, dimension_key: Vec<u8>, start_bucket: u64, end_bucket_exclusive: u64, descending: bool, ) -> Result<LedgerBitmapBucketIterator<'_>>

Source

fn event_bitmap_bucket_iter( &self, dimension_key: Vec<u8>, start_bucket: u64, end_bucket_exclusive: u64, descending: bool, ) -> Result<LedgerBitmapBucketIterator<'_>>

Provided Methods§

Source

fn get_highest_live_indexed_checkpoint_seq_number( &self, ) -> Result<Option<CheckpointSequenceNumber>>

The highest checkpoint the live-object cohort – the indexes derivable from the live object set (owned objects, types, and balances) – has committed, or None if it has not committed any checkpoint yet.

This is the frontier the health check measures against. The live-object indexes are restored to the tip and follow it, whereas the ledger-history cohort backfills independently after a restore; gating health on the latter would report a node unhealthy for the whole backfill even though its live-object reads are already caught up.

Defaults to Self::get_highest_indexed_checkpoint_seq_number for backends without a live/history cohort split, where every index tracks the tip together.

Source

fn get_highest_live_indexed_checkpoint_timestamp_ms( &self, ) -> Result<Option<u64>>

The chain timestamp, in milliseconds, of the checkpoint at Self::get_highest_live_indexed_checkpoint_seq_number, or None if the live-object cohort has not committed any checkpoint yet. Some(0) means the time is unknown, as for Self::get_highest_indexed_checkpoint_timestamp_ms.

Defaults to Self::get_highest_indexed_checkpoint_timestamp_ms for backends without a live/history cohort split.

Source

fn ledger_tx_seq_digest_multi_get( &self, tx_seqs: &[u64], ) -> Result<Vec<Option<LedgerTxSeqDigest>>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§