pub struct SectorId(/* private fields */);
Expand description
Data structure representing sector ID in farmer’s plot
Implementations§
source§impl SectorId
impl SectorId
sourcepub fn new(
public_key_hash: Blake3Hash,
sector_index: SectorIndex,
history_size: HistorySize,
) -> Self
pub fn new( public_key_hash: Blake3Hash, sector_index: SectorIndex, history_size: HistorySize, ) -> Self
Create new sector ID by deriving it from public key and sector index
sourcepub fn derive_piece_index(
&self,
piece_offset: PieceOffset,
history_size: HistorySize,
max_pieces_in_sector: u16,
recent_segments: HistorySize,
recent_history_fraction: (HistorySize, HistorySize),
) -> PieceIndex
pub fn derive_piece_index( &self, piece_offset: PieceOffset, history_size: HistorySize, max_pieces_in_sector: u16, recent_segments: HistorySize, recent_history_fraction: (HistorySize, HistorySize), ) -> PieceIndex
Derive piece index that should be stored in sector at piece_offset
for specified size of
blockchain history
sourcepub fn derive_sector_slot_challenge(
&self,
global_challenge: &Blake3Hash,
) -> SectorSlotChallenge
pub fn derive_sector_slot_challenge( &self, global_challenge: &Blake3Hash, ) -> SectorSlotChallenge
Derive sector slot challenge for this sector from provided global challenge
sourcepub fn derive_evaluation_seed(&self, piece_offset: PieceOffset) -> PosSeed
pub fn derive_evaluation_seed(&self, piece_offset: PieceOffset) -> PosSeed
Derive evaluation seed
sourcepub fn derive_expiration_history_size(
&self,
history_size: HistorySize,
sector_expiration_check_segment_commitment: &SegmentCommitment,
min_sector_lifetime: HistorySize,
) -> Option<HistorySize>
pub fn derive_expiration_history_size( &self, history_size: HistorySize, sector_expiration_check_segment_commitment: &SegmentCommitment, min_sector_lifetime: HistorySize, ) -> Option<HistorySize>
Derive history size when sector created at history_size
expires.
Returns None
on overflow.
Trait Implementations§
source§impl Decode for SectorId
impl Decode for SectorId
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
source§impl<'de> Deserialize<'de> for SectorId
impl<'de> Deserialize<'de> for SectorId
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
source§impl Encode for SectorId
impl Encode for SectorId
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl Ord for SectorId
impl Ord for SectorId
source§impl PartialOrd for SectorId
impl PartialOrd for SectorId
impl Copy for SectorId
impl EncodeLike for SectorId
impl Eq for SectorId
impl StructuralPartialEq for SectorId
Auto Trait Implementations§
impl Freeze for SectorId
impl RefUnwindSafe for SectorId
impl Send for SectorId
impl Sync for SectorId
impl Unpin for SectorId
impl UnwindSafe for SectorId
Blanket Implementations§
§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
§impl<U> AsSliceOf for U
impl<U> AsSliceOf for U
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Decode
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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>
Converts
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>
Converts
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§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
§fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
Return an encoding of
Self
prepended by given slice.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ToHex for T
impl<T> ToHex for T
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)