pub trait RuntimeObjectResolver: BackingPackageStore {
// Required methods
fn read_child_object(
&self,
parent: &ObjectID,
child: &ObjectID,
child_version_upper_bound: SequenceNumber,
) -> SuiResult<Option<Object>>;
fn get_object_received_at_version(
&self,
owner: &ObjectID,
receiving_object_id: &ObjectID,
receive_object_at_version: SequenceNumber,
epoch_id: EpochId,
) -> SuiResult<Option<Object>>;
// Provided method
fn get_package_at_version(
&self,
package_id: &ObjectID,
package_version: SequenceNumber,
) -> Option<MovePackage> { ... }
}Expand description
An abstraction of the (possibly distributed) store for objects. This API only allows for the retrieval of objects, not any state changes
Required Methods§
Sourcefn read_child_object(
&self,
parent: &ObjectID,
child: &ObjectID,
child_version_upper_bound: SequenceNumber,
) -> SuiResult<Option<Object>>
fn read_child_object( &self, parent: &ObjectID, child: &ObjectID, child_version_upper_bound: SequenceNumber, ) -> SuiResult<Option<Object>>
child must have an ObjectOwner ownership equal to owner.
Sourcefn get_object_received_at_version(
&self,
owner: &ObjectID,
receiving_object_id: &ObjectID,
receive_object_at_version: SequenceNumber,
epoch_id: EpochId,
) -> SuiResult<Option<Object>>
fn get_object_received_at_version( &self, owner: &ObjectID, receiving_object_id: &ObjectID, receive_object_at_version: SequenceNumber, epoch_id: EpochId, ) -> SuiResult<Option<Object>>
receiving_object_id must have an AddressOwner ownership equal to owner.
get_object_received_at_version must be the exact version at which the object will be received,
and it cannot have been previously received at that version. NB: An object not existing at
that version, and not having valid access to the object will be treated exactly the same
and Ok(None) must be returned.
Provided Methods§
Sourcefn get_package_at_version(
&self,
package_id: &ObjectID,
package_version: SequenceNumber,
) -> Option<MovePackage>
fn get_package_at_version( &self, package_id: &ObjectID, package_version: SequenceNumber, ) -> Option<MovePackage>
Get’s the package at the given version. Returns Some(package) only if the package_id is
a MovePackage with the given package_version. Returns None in all other cases.
Since the has the possibility of doing unsequenced reads of object IDs it is important here that:
- If the package object does not exist; or
- If the package object exists but is not a Move package; or
- If the package object exists and is a Move package, but the version is not the supplied version.
All return the same error.
To be extra careful, we simply return None in all cases unless the object is a package
with the exact version supplied, and let the caller decide how to handle it.