Sector Index #


import abi "github.com/filecoin-project/specs-actors/actors/abi"
import sector "github.com/filecoin-project/specs/systems/filecoin_mining/sector"
import piece "github.com/filecoin-project/specs/systems/filecoin_files/piece"
import smarkact "github.com/filecoin-project/specs-actors/actors/builtin/storage_market"

// TODO import this from StorageMarket
type SectorIndex struct {
    BySectorID     {abi.SectorID: sector.SectorInfo}
    ByUnsealedCID  {abi.UnsealedSectorCID: sector.SectorInfo}
    BySealedCID    {abi.SealedSectorCID: sector.SectorInfo}
    ByPieceID      {piece.PieceID: sector.SectorInfo}
    ByDealID       {abi.DealID: sector.SectorInfo}
}

type SectorIndexerSubsystem struct {
    Index    SectorIndex
    Store    SectorStore
    Builder  SectorBuilder

    // AddNewDeal is called by StorageMiningSubsystem after the StorageMarket
    // has made a deal. AddNewDeal returns an error when:
    // - there is no capacity to store more deals and their pieces
    AddNewDeal(deal smarkact.StorageDeal) StageDealResponse

    // bring back if needed.
    // OnNewTipset(chain Chain, epoch abi.Epoch) struct {}

    // SectorsExpiredAtEpoch returns the set of sectors that expire
    // at a particular epoch.
    SectorsExpiredAtEpoch(epoch abi.ChainEpoch) [abi.SectorID]

    // removeSectors removes the given sectorIDs from storage.
    removeSectors(sectorIDs [abi.SectorID])
}