storage-fsm updates for sector packing

This commit is contained in:
Łukasz Magiera 2020-06-26 15:13:18 +02:00
parent a6d1323eba
commit a7c372efff
5 changed files with 12 additions and 17 deletions

View File

@ -286,7 +286,7 @@ var stateSectorsCmd = &cli.Command{
}
for _, s := range sectors {
fmt.Printf("%d: %x\n", s.Info.Info.SectorNumber, s.Info.Info.SealedCID)
fmt.Printf("%d: %x\n", s.Info.SectorNumber, s.Info.SealedCID)
}
return nil

View File

@ -26,9 +26,9 @@ type MsigAPI struct {
MpoolAPI MpoolAPI
}
func (a *MsigAPI) MsigCreate(ctx context.Context, req int64, addrs []address.Address, val types.BigInt, src address.Address, gp types.BigInt) (cid.Cid, error) {
func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Address, val types.BigInt, src address.Address, gp types.BigInt) (cid.Cid, error) {
lenAddrs := int64(len(addrs))
lenAddrs := uint64(len(addrs))
if lenAddrs < req {
return cid.Undef, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")

View File

@ -16,12 +16,8 @@ func (m *Miner) Address() address.Address {
return m.sealing.Address()
}
func (m *Miner) AllocatePiece(size abi.UnpaddedPieceSize) (sectorID abi.SectorNumber, offset uint64, err error) {
return m.sealing.AllocatePiece(size)
}
func (m *Miner) SealPiece(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, sectorID abi.SectorNumber, d sealing.DealInfo) error {
return m.sealing.SealPiece(ctx, size, r, sectorID, d)
func (m *Miner) AddPieceToAnySector(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d sealing.DealInfo) (abi.SectorNumber, uint64, error) {
return m.sealing.AddPieceToAnySector(ctx, size, r, d)
}
func (m *Miner) ListSectors() ([]sealing.SectorInfo, error) {

View File

@ -15,7 +15,6 @@ import (
"golang.org/x/xerrors"
cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/go-padreader"
"github.com/filecoin-project/specs-actors/actors/abi"
sealing "github.com/filecoin-project/storage-fsm"
@ -97,18 +96,18 @@ func (st *SectorBlocks) writeRef(dealID abi.DealID, sectorID abi.SectorNumber, o
return st.keys.Put(DealIDToDsKey(dealID), newRef) // TODO: batch somehow
}
func (st *SectorBlocks) AddPiece(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d sealing.DealInfo) (sectorID abi.SectorNumber, err error) {
sectorID, pieceOffset, err := st.Miner.AllocatePiece(padreader.PaddedSize(uint64(size)))
func (st *SectorBlocks) AddPiece(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d sealing.DealInfo) (abi.SectorNumber, error) {
sn, offset, err := st.Miner.AddPieceToAnySector(ctx, size, r, d)
if err != nil {
return 0, err
}
err = st.writeRef(d.DealID, sectorID, pieceOffset, size)
err = st.writeRef(d.DealID, sn, offset, size)
if err != nil {
return 0, err
return 0, xerrors.Errorf("writeRef: %w", err)
}
return sectorID, st.Miner.SealPiece(ctx, size, r, sectorID, d)
return sn, nil
}
func (st *SectorBlocks) List() (map[uint64][]api.SealedRef, error) {

View File

@ -463,8 +463,8 @@ func (s *WindowPoStScheduler) sortedSectorInfo(ctx context.Context, deadlineSect
for k, sector := range sset {
sbsi[k] = abi.SectorInfo{
SectorNumber: sector.ID,
SealedCID: sector.Info.Info.SealedCID,
SealProof: sector.Info.Info.SealProof,
SealedCID: sector.Info.SealedCID,
SealProof: sector.Info.SealProof,
}
}