pub enum ShardLayout {
V0(ShardLayoutV0),
V1(ShardLayoutV1),
}Variants§
V0(ShardLayoutV0)
V1(ShardLayoutV1)
Implementations§
Source§impl ShardLayout
impl ShardLayout
pub fn v0_single_shard() -> Self
Sourcepub fn v0(num_shards: NumShards, version: ShardVersion) -> Self
pub fn v0(num_shards: NumShards, version: ShardVersion) -> Self
Return a V0 Shardlayout
Sourcepub fn v1(
boundary_accounts: Vec<AccountId>,
shards_split_map: Option<Vec<Vec<ShardId>>>,
version: ShardVersion,
) -> Self
pub fn v1( boundary_accounts: Vec<AccountId>, shards_split_map: Option<Vec<Vec<ShardId>>>, version: ShardVersion, ) -> Self
Return a V1 Shardlayout
Sourcepub fn get_children_shards_uids(
&self,
parent_shard_id: ShardId,
) -> Option<Vec<ShardUId>>
pub fn get_children_shards_uids( &self, parent_shard_id: ShardId, ) -> Option<Vec<ShardUId>>
Given a parent shard id, return the shard uids for the shards in the current shard layout that are split from this parent shard. If this shard layout has no parent shard layout, return None
Sourcepub fn get_children_shards_ids(
&self,
parent_shard_id: ShardId,
) -> Option<Vec<ShardId>>
pub fn get_children_shards_ids( &self, parent_shard_id: ShardId, ) -> Option<Vec<ShardId>>
Given a parent shard id, return the shard ids for the shards in the current shard layout that are split from this parent shard. If this shard layout has no parent shard layout, return None
Sourcepub fn get_parent_shard_id(
&self,
shard_id: ShardId,
) -> Result<ShardId, ShardLayoutError>
pub fn get_parent_shard_id( &self, shard_id: ShardId, ) -> Result<ShardId, ShardLayoutError>
Return the parent shard id for a given shard in the shard layout
Only calls this function for shard layout that has parent shard layouts
Returns error if shard_id is an invalid shard id in the current layout
Panics if self has no parent shard layout
pub fn version(&self) -> ShardVersion
pub fn shard_ids(&self) -> impl Iterator<Item = ShardId>
Sourcepub fn shard_uids(&self) -> impl Iterator<Item = ShardUId> + '_
pub fn shard_uids(&self) -> impl Iterator<Item = ShardUId> + '_
Returns an iterator that iterates over all the shard uids for all the shards in the shard layout
Trait Implementations§
Source§impl Clone for ShardLayout
impl Clone for ShardLayout
Source§fn clone(&self) -> ShardLayout
fn clone(&self) -> ShardLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ShardLayout
impl Debug for ShardLayout
Source§impl<'de> Deserialize<'de> for ShardLayout
impl<'de> Deserialize<'de> for ShardLayout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ShardLayout
impl PartialEq for ShardLayout
Source§impl Serialize for ShardLayout
impl Serialize for ShardLayout
impl Eq for ShardLayout
impl StructuralPartialEq for ShardLayout
Auto Trait Implementations§
impl Freeze for ShardLayout
impl RefUnwindSafe for ShardLayout
impl Send for ShardLayout
impl Sync for ShardLayout
impl Unpin for ShardLayout
impl UnwindSafe for ShardLayout
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more