lotus/storage/sealmgr/advmgr/roprov.go

28 lines
738 B
Go
Raw Normal View History

package advmgr
import (
2020-03-06 05:30:47 +00:00
"context"
"github.com/filecoin-project/go-sectorbuilder"
"github.com/filecoin-project/lotus/storage/sealmgr/stores"
"github.com/filecoin-project/specs-actors/actors/abi"
"golang.org/x/xerrors"
)
type readonlyProvider struct {
miner abi.ActorID
stor *stores.Local
}
2020-03-06 05:30:47 +00:00
func (l *readonlyProvider) AcquireSector(ctx context.Context, id abi.SectorNumber, existing sectorbuilder.SectorFileType, allocate sectorbuilder.SectorFileType, sealing bool) (sectorbuilder.SectorPaths, func(), error) {
if allocate != 0 {
return sectorbuilder.SectorPaths{}, nil, xerrors.New("read-only storage")
}
2020-03-13 01:37:38 +00:00
return l.stor.AcquireSector(ctx, abi.SectorID{
2020-03-13 11:59:19 +00:00
Miner: l.miner,
Number: id,
}, existing, allocate, sealing)
}