pub struct ShardUId {
pub shard_id: u32,
pub version: u32,
}
Expand description
ShardUId
is a unique representation for shards from different shard layouts.
Comparing to ShardId
, which is just an ordinal number ranging from 0 to NUM_SHARDS-1,
ShardUId
provides a way to unique identify shards when shard layouts may change across epochs.
This is important because we store states indexed by shards in our database, so we need a
way to unique identify shard even when shards change across epochs.
Another difference between ShardUId
and ShardId
is that ShardUId
should only exist in
a node’s internal state while ShardId
can be exposed to outside APIs and used in protocol
level information (for example, ShardChunkHeader
contains ShardId
instead of ShardUId
)
JSON schema
{
"description": "`ShardUId` is a unique representation for shards from different shard layouts.\n\nComparing to `ShardId`, which is just an ordinal number ranging from 0 to NUM_SHARDS-1,\n`ShardUId` provides a way to unique identify shards when shard layouts may change across epochs.\nThis is important because we store states indexed by shards in our database, so we need a\nway to unique identify shard even when shards change across epochs.\nAnother difference between `ShardUId` and `ShardId` is that `ShardUId` should only exist in\na node's internal state while `ShardId` can be exposed to outside APIs and used in protocol\nlevel information (for example, `ShardChunkHeader` contains `ShardId` instead of `ShardUId`)",
"type": "object",
"required": [
"shard_id",
"version"
],
"properties": {
"shard_id": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
},
"version": {
"type": "integer",
"format": "uint32",
"minimum": 0.0
}
}
}
Fields§
§shard_id: u32
§version: u32
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ShardUId
impl<'de> Deserialize<'de> for ShardUId
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ShardUId
impl RefUnwindSafe for ShardUId
impl Send for ShardUId
impl Sync for ShardUId
impl Unpin for ShardUId
impl UnwindSafe for ShardUId
Blanket Implementations§
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
Mutably borrows from an owned value. Read more