Sector Builder #


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

// SectorBuilder accumulates deals, keeping track of their
// sector configuration requirements and the piece sizes.
// Once there is a sector ready to be sealed, NextSector
// will return a sector.

type StageDealResponse struct {
    SectorID abi.SectorID
}

type SectorBuilder struct {
    // DealsToSeal keeps a set of StorageDeal objects.
    // These include the info for the relevant pieces.
    // This builder just accumulates deals, keeping track of their
    // sector configuration requirements, and the piece sizes.
    DealsToSeal [smarkact.StorageDeal]

    // StageDeal adds a deal to be packed into a sector.
    StageDeal(d smarkact.StorageDeal) StageDealResponse

    // NextSector returns an UnsealedSectorInfo, which includes the (ordered) set of
    // pieces, and the SealCfg. An error may be returned if SectorBuilder is not
    // ready to produce a Sector.
    //
    // TODO: use go channels? or notifications?
    NextSector() union {i sector.UnsealedSectorInfo, err error}
}