storage-fsm updates for sector packing
This commit is contained in:
parent
a6d1323eba
commit
a7c372efff
@ -286,7 +286,7 @@ var stateSectorsCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range sectors {
|
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
|
return nil
|
||||||
|
@ -26,9 +26,9 @@ type MsigAPI struct {
|
|||||||
MpoolAPI MpoolAPI
|
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 {
|
if lenAddrs < req {
|
||||||
return cid.Undef, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
|
return cid.Undef, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
|
||||||
|
@ -16,12 +16,8 @@ func (m *Miner) Address() address.Address {
|
|||||||
return m.sealing.Address()
|
return m.sealing.Address()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Miner) AllocatePiece(size abi.UnpaddedPieceSize) (sectorID abi.SectorNumber, offset uint64, err error) {
|
func (m *Miner) AddPieceToAnySector(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d sealing.DealInfo) (abi.SectorNumber, uint64, error) {
|
||||||
return m.sealing.AllocatePiece(size)
|
return m.sealing.AddPieceToAnySector(ctx, size, r, d)
|
||||||
}
|
|
||||||
|
|
||||||
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) ListSectors() ([]sealing.SectorInfo, error) {
|
func (m *Miner) ListSectors() ([]sealing.SectorInfo, error) {
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
cborutil "github.com/filecoin-project/go-cbor-util"
|
cborutil "github.com/filecoin-project/go-cbor-util"
|
||||||
"github.com/filecoin-project/go-padreader"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
sealing "github.com/filecoin-project/storage-fsm"
|
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
|
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) {
|
func (st *SectorBlocks) AddPiece(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d sealing.DealInfo) (abi.SectorNumber, error) {
|
||||||
sectorID, pieceOffset, err := st.Miner.AllocatePiece(padreader.PaddedSize(uint64(size)))
|
sn, offset, err := st.Miner.AddPieceToAnySector(ctx, size, r, d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = st.writeRef(d.DealID, sectorID, pieceOffset, size)
|
err = st.writeRef(d.DealID, sn, offset, size)
|
||||||
if err != nil {
|
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) {
|
func (st *SectorBlocks) List() (map[uint64][]api.SealedRef, error) {
|
||||||
|
@ -463,8 +463,8 @@ func (s *WindowPoStScheduler) sortedSectorInfo(ctx context.Context, deadlineSect
|
|||||||
for k, sector := range sset {
|
for k, sector := range sset {
|
||||||
sbsi[k] = abi.SectorInfo{
|
sbsi[k] = abi.SectorInfo{
|
||||||
SectorNumber: sector.ID,
|
SectorNumber: sector.ID,
|
||||||
SealedCID: sector.Info.Info.SealedCID,
|
SealedCID: sector.Info.SealedCID,
|
||||||
SealProof: sector.Info.Info.SealProof,
|
SealProof: sector.Info.SealProof,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user