Struct forest_actor::miner::Partition[][src]

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

impl Partition[src]

pub fn new<BS: BlockStore>(store: &BS) -> Result<Self, Box<dyn StdError>>[src]

pub fn live_sectors(&self) -> BitField[src]

Live sectors are those that are not terminated (but may be faulty).

pub fn active_sectors(&self) -> BitField[src]

Active sectors are those that are neither terminated nor faulty nor unproven, i.e. actively contributing power.

pub fn active_power(&self) -> PowerPair[src]

Active power is power of non-faulty sectors.

pub fn add_sectors<BS: BlockStore>(
    &mut self,
    store: &BS,
    proven: bool,
    sectors: &[SectorOnChainInfo],
    sector_size: SectorSize,
    quant: QuantSpec
) -> Result<PowerPair, Box<dyn StdError>>
[src]

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.

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), Box<dyn StdError>>
[src]

marks a set of sectors faulty

pub fn record_faults<BS: BlockStore>(
    &mut self,
    store: &BS,
    sectors: &Sectors<'_, BS>,
    sector_numbers: &mut UnvalidatedBitField,
    fault_expiration_epoch: ChainEpoch,
    sector_size: SectorSize,
    quant: QuantSpec
) -> Result<(BitField, PowerPair, PowerPair), Box<dyn StdError>>
[src]

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.

pub fn recover_faults<BS: BlockStore>(
    &mut self,
    store: &BS,
    sectors: &Sectors<'_, BS>,
    sector_size: SectorSize,
    quant: QuantSpec
) -> Result<PowerPair, Box<dyn StdError>>
[src]

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.

pub fn activate_unproven(&mut self) -> PowerPair[src]

Activates unproven sectors, returning the activated power.

pub fn declare_faults_recovered<BS: BlockStore>(
    &mut self,
    sectors: &Sectors<'_, BS>,
    sector_size: SectorSize,
    sector_numbers: &mut UnvalidatedBitField
) -> Result<(), Box<dyn StdError>>
[src]

Declares sectors as recovering. Non-faulty and already recovering sectors will be skipped.

pub fn remove_recoveries(
    &mut self,
    sector_numbers: &BitField,
    power: &PowerPair
)
[src]

Removes sectors from recoveries and recovering power. Assumes sectors are currently faulty and recovering.

pub fn reschedule_expirations<BS: BlockStore>(
    &mut self,
    store: &BS,
    sectors: &Sectors<'_, BS>,
    new_expiration: ChainEpoch,
    sector_numbers: &mut UnvalidatedBitField,
    sector_size: SectorSize,
    quant: QuantSpec
) -> Result<Vec<SectorOnChainInfo>, Box<dyn StdError>>
[src]

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.

pub fn replace_sectors<BS: BlockStore>(
    &mut self,
    store: &BS,
    old_sectors: &[SectorOnChainInfo],
    new_sectors: &[SectorOnChainInfo],
    sector_size: SectorSize,
    quant: QuantSpec
) -> Result<(PowerPair, TokenAmount), Box<dyn StdError>>
[src]

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.

pub fn record_early_termination<BS: BlockStore>(
    &mut self,
    store: &BS,
    epoch: ChainEpoch,
    sectors: &BitField
) -> Result<(), Box<dyn StdError>>
[src]

Record the epoch of any sectors expiring early, for termination fee calculation later.

pub fn terminate_sectors<BS: BlockStore>(
    &mut self,
    store: &BS,
    sectors: &Sectors<'_, BS>,
    epoch: ChainEpoch,
    sector_numbers: &mut UnvalidatedBitField,
    sector_size: SectorSize,
    quant: QuantSpec
) -> Result<ExpirationSet, Box<dyn StdError>>
[src]

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.

pub fn pop_expired_sectors<BS: BlockStore>(
    &mut self,
    store: &BS,
    until: ChainEpoch,
    quant: QuantSpec
) -> Result<ExpirationSet, Box<dyn StdError>>
[src]

PopExpiredSectors traverses the expiration queue up to and including some epoch, and marks all expiring sectors as terminated. Returns the expired sector aggregates.

pub fn record_missed_post<BS: BlockStore>(
    &mut self,
    store: &BS,
    fault_expiration: ChainEpoch,
    quant: QuantSpec
) -> Result<(PowerPair, PowerPair, PowerPair), Box<dyn StdError>>
[src]

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), Box<dyn StdError>>
[src]

pub fn record_skipped_faults<BS: BlockStore>(
    &mut self,
    store: &BS,
    sectors: &Sectors<'_, BS>,
    sector_size: SectorSize,
    quant: QuantSpec,
    fault_expiration: ChainEpoch,
    skipped: &mut UnvalidatedBitField
) -> Result<(PowerPair, PowerPair, PowerPair, bool), Box<dyn StdError>>
[src]

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 delcared recovered) are ignored.

pub fn validate_power_state(&self) -> Result<(), &'static str>[src]

Test invariants about the partition power are valid.

pub fn validate_bf_state(&self) -> Result<(), &'static str>[src]

pub fn validate_state(&self) -> Result<(), String>[src]

Trait Implementations

impl Clone for Partition[src]

fn clone(&self) -> Partition[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'de> Deserialize<'de> for Partition[src]

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Partition[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]