Struct forest_actor::miner::ExpirationQueue[][src]

pub struct ExpirationQueue<'db, BS> {
    pub amt: Amt<'db, ExpirationSet, BS>,
    pub quant: QuantSpec,
}
Expand description

A queue of expiration sets by epoch, representing the on-time or early termination epoch for a collection of sectors. Wraps an AMTChainEpoch*ExpirationSet. Keys in the queue are quantized (upwards), modulo some offset, to reduce the cardinality of keys.

Fields

amt: Amt<'db, ExpirationSet, BS>quant: QuantSpec

Implementations

impl<'db, BS: BlockStore> ExpirationQueue<'db, BS>[src]

pub fn new(
    store: &'db BS,
    root: &Cid,
    quant: QuantSpec
) -> Result<Self, AmtError>
[src]

Loads a queue root.

Epochs provided to subsequent method calls will be quantized upwards to quanta mod offsetSeed before being written to/read from queue entries.

pub fn add_active_sectors<'a>(
    &mut self,
    sectors: impl IntoIterator<Item = &'a SectorOnChainInfo>,
    sector_size: SectorSize
) -> Result<(BitField, PowerPair, TokenAmount), Box<dyn StdError>>
[src]

Adds a collection of sectors to their on-time target expiration entries (quantized). The sectors are assumed to be active (non-faulty). Returns the sector numbers, power, and pledge added.

pub fn reschedule_expirations(
    &mut self,
    new_expiration: ChainEpoch,
    sectors: &[SectorOnChainInfo],
    sector_size: SectorSize
) -> Result<(), Box<dyn StdError>>
[src]

Reschedules some sectors to a new (quantized) expiration epoch. The sectors being rescheduled are assumed to be not faulty, and hence are removed from and re-scheduled for on-time rather than early expiration. The sectors’ power and pledge are assumed not to change, despite the new expiration.

pub fn reschedule_as_faults(
    &mut self,
    new_expiration: ChainEpoch,
    sectors: &[SectorOnChainInfo],
    sector_size: SectorSize
) -> Result<PowerPair, Box<dyn StdError>>
[src]

Re-schedules sectors to expire at an early expiration epoch (quantized), if they wouldn’t expire before then anyway. The sectors must not be currently faulty, so must be registered as expiring on-time rather than early. The pledge for the now-early sectors is removed from the queue. Returns the total power represented by the sectors.

pub fn reschedule_all_as_faults(
    &mut self,
    fault_expiration: ChainEpoch
) -> Result<(), Box<dyn StdError>>
[src]

Re-schedules all sectors to expire at an early expiration epoch, if they wouldn’t expire before then anyway.

pub fn reschedule_recovered(
    &mut self,
    sectors: Vec<SectorOnChainInfo>,
    sector_size: SectorSize
) -> Result<PowerPair, Box<dyn StdError>>
[src]

Removes sectors from any queue entries in which they appear that are earlier then their scheduled expiration epoch, and schedules them at their expected termination epoch. Pledge for the sectors is re-added as on-time. Power for the sectors is changed from faulty to active (whether rescheduled or not). Returns the newly-recovered power. Fails if any sectors are not found in the queue.

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

Removes some sectors and adds some others. The sectors being replaced must not be faulty, so must be scheduled for on-time rather than early expiration. The sectors added are assumed to be not faulty. Returns the old a new sector number bitfields, and delta to power and pledge, new minus old.

pub fn remove_sectors(
    &mut self,
    sectors: &[SectorOnChainInfo],
    faults: &BitField,
    recovering: &BitField,
    sector_size: SectorSize
) -> Result<(ExpirationSet, PowerPair), Box<dyn StdError>>
[src]

Remove some sectors from the queue. The sectors may be active or faulty, and scheduled either for on-time or early termination. Returns the aggregate of removed sectors and power, and recovering power. Fails if any sectors are not found in the queue.

pub fn pop_until(
    &mut self,
    until: ChainEpoch
) -> Result<ExpirationSet, Box<dyn StdError>>
[src]

Removes and aggregates entries from the queue up to and including some epoch.

Auto Trait Implementations

impl<'db, BS> RefUnwindSafe for ExpirationQueue<'db, BS> where
    BS: RefUnwindSafe

impl<'db, BS> Send for ExpirationQueue<'db, BS> where
    BS: Sync

impl<'db, BS> !Sync for ExpirationQueue<'db, BS>

impl<'db, BS> Unpin for ExpirationQueue<'db, BS>

impl<'db, BS> UnwindSafe for ExpirationQueue<'db, BS> where
    BS: RefUnwindSafe

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, 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