lotus/storage/sectorstorage/roprov.go

26 lines
714 B
Go
Raw Normal View History

2020-03-23 11:40:02 +00:00
package sectorstorage
import (
2020-03-06 05:30:47 +00:00
"context"
"github.com/filecoin-project/go-sectorbuilder"
2020-03-23 11:40:02 +00:00
"github.com/filecoin-project/lotus/storage/sectorstorage/stores"
"github.com/filecoin-project/specs-actors/actors/abi"
"golang.org/x/xerrors"
)
type readonlyProvider struct {
2020-03-18 01:08:11 +00:00
stor *stores.Local
}
2020-03-17 20:19:52 +00:00
func (l *readonlyProvider) AcquireSector(ctx context.Context, id abi.SectorID, 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-17 20:19:52 +00:00
p, _, done, err := l.stor.AcquireSector(ctx, id, existing, allocate, sealing)
return p, done, err
}