Struct fil_actor_miner_state::v14::Partition
source · pub struct Partition {
pub sectors: BitField,
pub unproven: BitField,
pub faults: BitField,
pub recoveries: BitField,
pub terminated: BitField,
pub expirations_epochs: Cid,
pub early_terminated: Cid,
pub live_power: PowerPair,
pub unproven_power: PowerPair,
pub faulty_power: PowerPair,
pub recovering_power: PowerPair,
}
Fields§
§sectors: BitField
Sector numbers in this partition, including faulty, unproven and terminated sectors.
unproven: BitField
Unproven sectors in this partition. This bitfield will be cleared on a successful window post (or at the end of the partition’s next deadline). At that time, any still unproven sectors will be added to the faulty sector bitfield.
faults: BitField
Subset of sectors detected/declared faulty and not yet recovered (excl. from PoSt). Faults ∩ Terminated = ∅
recoveries: BitField
Subset of faulty sectors expected to recover on next PoSt Recoveries ∩ Terminated = ∅
terminated: BitField
Subset of sectors terminated but not yet removed from partition (excl. from PoSt)
expirations_epochs: Cid
Maps epochs sectors that expire in or before that epoch. An expiration may be an “on-time” scheduled expiration, or early “faulty” expiration. Keys are quantized to last-in-deadline epochs.
early_terminated: Cid
Subset of terminated that were before their committed expiration epoch, by termination epoch. Termination fees have not yet been calculated or paid and associated deals have not yet been canceled but effective power has already been adjusted. Not quantized.
live_power: PowerPair
Power of not-yet-terminated sectors (incl faulty & unproven).
unproven_power: PowerPair
Power of yet-to-be-proved sectors (never faulty).
faulty_power: PowerPair
Power of currently-faulty sectors. FaultyPower <= LivePower.
recovering_power: PowerPair
Power of expected-to-recover sectors. RecoveringPower <= FaultyPower.
Implementations§
source§impl Partition
impl Partition
pub fn new<BS: Blockstore>(store: &BS) -> Result<Self>
sourcepub fn live_sectors(&self) -> BitField
pub fn live_sectors(&self) -> BitField
Live sectors are those that are not terminated (but may be faulty).
sourcepub fn active_sectors(&self) -> BitField
pub fn active_sectors(&self) -> BitField
Active sectors are those that are neither terminated nor faulty nor unproven, i.e. actively contributing power.
sourcepub fn active_power(&self) -> PowerPair
pub fn active_power(&self) -> PowerPair
Active power is power of non-faulty sectors.
sourcepub fn add_sectors<BS: Blockstore>(
&mut self,
store: &BS,
proven: bool,
sectors: &[SectorOnChainInfo],
sector_size: SectorSize,
quant: QuantSpec,
) -> Result<PowerPair>
pub fn add_sectors<BS: Blockstore>( &mut self, store: &BS, proven: bool, sectors: &[SectorOnChainInfo], sector_size: SectorSize, quant: QuantSpec, ) -> Result<PowerPair>
AddSectors adds new sectors to the partition. The sectors are “live”, neither faulty, recovering, nor terminated. Each new sector’s expiration is scheduled shortly after its target expiration epoch.
sourcepub fn add_faults<BS: Blockstore>(
&mut self,
store: &BS,
sector_numbers: &BitField,
sectors: &[SectorOnChainInfo],
fault_expiration: ChainEpoch,
sector_size: SectorSize,
quant: QuantSpec,
) -> Result<(PowerPair, PowerPair)>
pub fn add_faults<BS: Blockstore>( &mut self, store: &BS, sector_numbers: &BitField, sectors: &[SectorOnChainInfo], fault_expiration: ChainEpoch, sector_size: SectorSize, quant: QuantSpec, ) -> Result<(PowerPair, PowerPair)>
marks a set of sectors faulty
sourcepub fn record_faults<BS: Blockstore>(
&mut self,
store: &BS,
sectors: &Sectors<'_, BS>,
sector_numbers: &BitField,
fault_expiration_epoch: ChainEpoch,
sector_size: SectorSize,
quant: QuantSpec,
) -> Result<(BitField, PowerPair, PowerPair)>
pub fn record_faults<BS: Blockstore>( &mut self, store: &BS, sectors: &Sectors<'_, BS>, sector_numbers: &BitField, fault_expiration_epoch: ChainEpoch, sector_size: SectorSize, quant: QuantSpec, ) -> Result<(BitField, PowerPair, PowerPair)>
Declares a set of sectors faulty. Already faulty sectors are ignored, terminated sectors are skipped, and recovering sectors are reverted to faulty.
- New faults are added to the Faults bitfield and the FaultyPower is increased.
- The sectors’ expirations are rescheduled to the fault expiration epoch, as “early” (if not expiring earlier).
Returns the power of the now-faulty sectors.
sourcepub fn recover_faults<BS: Blockstore>(
&mut self,
store: &BS,
sectors: &Sectors<'_, BS>,
sector_size: SectorSize,
quant: QuantSpec,
) -> Result<PowerPair>
pub fn recover_faults<BS: Blockstore>( &mut self, store: &BS, sectors: &Sectors<'_, BS>, sector_size: SectorSize, quant: QuantSpec, ) -> Result<PowerPair>
Removes sector numbers from faults and thus from recoveries. The sectors are removed from the Faults and Recovering bitfields, and FaultyPower and RecoveringPower reduced. The sectors are re-scheduled for expiration shortly after their target expiration epoch. Returns the power of the now-recovered sectors.
sourcepub fn activate_unproven(&mut self) -> PowerPair
pub fn activate_unproven(&mut self) -> PowerPair
Activates unproven sectors, returning the activated power.
sourcepub fn declare_faults_recovered<BS: Blockstore>(
&mut self,
sectors: &Sectors<'_, BS>,
sector_size: SectorSize,
sector_numbers: &BitField,
) -> Result<()>
pub fn declare_faults_recovered<BS: Blockstore>( &mut self, sectors: &Sectors<'_, BS>, sector_size: SectorSize, sector_numbers: &BitField, ) -> Result<()>
Declares sectors as recovering. Non-faulty and already recovering sectors will be skipped.
sourcepub fn remove_recoveries(
&mut self,
sector_numbers: &BitField,
power: &PowerPair,
)
pub fn remove_recoveries( &mut self, sector_numbers: &BitField, power: &PowerPair, )
Removes sectors from recoveries and recovering power. Assumes sectors are currently faulty and recovering.
sourcepub fn reschedule_expirations<BS: Blockstore>(
&mut self,
store: &BS,
sectors: &Sectors<'_, BS>,
new_expiration: ChainEpoch,
sector_numbers: &BitField,
sector_size: SectorSize,
quant: QuantSpec,
) -> Result<Vec<SectorOnChainInfo>>
pub fn reschedule_expirations<BS: Blockstore>( &mut self, store: &BS, sectors: &Sectors<'_, BS>, new_expiration: ChainEpoch, sector_numbers: &BitField, sector_size: SectorSize, quant: QuantSpec, ) -> Result<Vec<SectorOnChainInfo>>
RescheduleExpirations moves expiring sectors to the target expiration, skipping any sectors it can’t find.
The power of the rescheduled sectors is assumed to have not changed since initial scheduling.
Note: see the docs on State.RescheduleSectorExpirations for details on why we skip sectors/partitions we can’t find.
sourcepub fn replace_sectors<BS: Blockstore>(
&mut self,
store: &BS,
old_sectors: &[SectorOnChainInfo],
new_sectors: &[SectorOnChainInfo],
sector_size: SectorSize,
quant: QuantSpec,
) -> Result<(PowerPair, TokenAmount)>
pub fn replace_sectors<BS: Blockstore>( &mut self, store: &BS, old_sectors: &[SectorOnChainInfo], new_sectors: &[SectorOnChainInfo], sector_size: SectorSize, quant: QuantSpec, ) -> Result<(PowerPair, TokenAmount)>
Replaces a number of “old” sectors with new ones. The old sectors must not be faulty or terminated. If the same sector is both removed and added, this permits rescheduling with a change in power, unlike RescheduleExpirations. Returns the delta to power and pledge requirement.
sourcepub fn record_early_termination<BS: Blockstore>(
&mut self,
store: &BS,
epoch: ChainEpoch,
sectors: &BitField,
) -> Result<()>
pub fn record_early_termination<BS: Blockstore>( &mut self, store: &BS, epoch: ChainEpoch, sectors: &BitField, ) -> Result<()>
Record the epoch of any sectors expiring early, for termination fee calculation later.
sourcepub fn terminate_sectors<BS: Blockstore>(
&mut self,
policy: &Policy,
store: &BS,
sectors: &Sectors<'_, BS>,
epoch: ChainEpoch,
sector_numbers: &BitField,
sector_size: SectorSize,
quant: QuantSpec,
) -> Result<ExpirationSet>
pub fn terminate_sectors<BS: Blockstore>( &mut self, policy: &Policy, store: &BS, sectors: &Sectors<'_, BS>, epoch: ChainEpoch, sector_numbers: &BitField, sector_size: SectorSize, quant: QuantSpec, ) -> Result<ExpirationSet>
Marks a collection of sectors as terminated. The sectors are removed from Faults and Recoveries. The epoch of termination is recorded for future termination fee calculation.
sourcepub fn pop_expired_sectors<BS: Blockstore>(
&mut self,
store: &BS,
until: ChainEpoch,
quant: QuantSpec,
) -> Result<ExpirationSet>
pub fn pop_expired_sectors<BS: Blockstore>( &mut self, store: &BS, until: ChainEpoch, quant: QuantSpec, ) -> Result<ExpirationSet>
PopExpiredSectors traverses the expiration queue up to and including some epoch, and marks all expiring sectors as terminated. Returns the expired sector aggregates.
sourcepub fn record_missed_post<BS: Blockstore>(
&mut self,
store: &BS,
fault_expiration: ChainEpoch,
quant: QuantSpec,
) -> Result<(PowerPair, PowerPair, PowerPair)>
pub fn record_missed_post<BS: Blockstore>( &mut self, store: &BS, fault_expiration: ChainEpoch, quant: QuantSpec, ) -> Result<(PowerPair, PowerPair, PowerPair)>
Marks all non-faulty sectors in the partition as faulty and clears recoveries, updating power memos appropriately. All sectors’ expirations are rescheduled to the fault expiration, as “early” (if not expiring earlier) Returns the power of the newly faulty and failed recovery sectors.
pub fn pop_early_terminations<BS: Blockstore>( &mut self, store: &BS, max_sectors: u64, ) -> Result<(TerminationResult, bool)>
sourcepub fn record_skipped_faults<BS: Blockstore>(
&mut self,
store: &BS,
sectors: &Sectors<'_, BS>,
sector_size: SectorSize,
quant: QuantSpec,
fault_expiration: ChainEpoch,
skipped: &BitField,
) -> Result<(PowerPair, PowerPair, PowerPair, bool)>
pub fn record_skipped_faults<BS: Blockstore>( &mut self, store: &BS, sectors: &Sectors<'_, BS>, sector_size: SectorSize, quant: QuantSpec, fault_expiration: ChainEpoch, skipped: &BitField, ) -> Result<(PowerPair, PowerPair, PowerPair, bool)>
Discovers how skipped faults declared during post intersect with existing faults and recoveries, records the new faults in state. Returns the amount of power newly faulty, or declared recovered but faulty again.
- Skipped faults that are not in the provided partition triggers an error.
- Skipped faults that are already declared (but not declared recovered) are ignored.
sourcepub fn validate_power_state(&self) -> Result<()>
pub fn validate_power_state(&self) -> Result<()>
Test invariants about the partition power are valid.
pub fn validate_bf_state(&self) -> Result<()>
pub fn validate_state(&self) -> Result<()>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Partition
impl<'de> Deserialize<'de> for Partition
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>,
Auto Trait Implementations§
impl Freeze for Partition
impl RefUnwindSafe for Partition
impl Send for Partition
impl Sync for Partition
impl Unpin for Partition
impl UnwindSafe for Partition
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.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 moresource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> References<RawCodec> for T
impl<T> References<RawCodec> for T
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.