2020-03-23 11:40:02 +00:00
|
|
|
package sectorstorage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-03-27 20:08:06 +00:00
|
|
|
"golang.org/x/xerrors"
|
2020-03-23 11:40:02 +00:00
|
|
|
|
|
|
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
2020-03-27 20:08:06 +00:00
|
|
|
|
2020-03-27 23:21:36 +00:00
|
|
|
"github.com/filecoin-project/sector-storage/stores"
|
2020-03-23 11:40:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type readonlyProvider struct {
|
|
|
|
stor *stores.Local
|
2020-05-08 16:54:06 +00:00
|
|
|
spt abi.RegisteredProof
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-26 02:50:56 +00:00
|
|
|
func (l *readonlyProvider) AcquireSector(ctx context.Context, id abi.SectorID, existing stores.SectorFileType, allocate stores.SectorFileType, sealing bool) (stores.SectorPaths, func(), error) {
|
2020-03-25 20:19:58 +00:00
|
|
|
if allocate != stores.FTNone {
|
2020-03-26 02:50:56 +00:00
|
|
|
return stores.SectorPaths{}, nil, xerrors.New("read-only storage")
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 16:54:06 +00:00
|
|
|
p, _, done, err := l.stor.AcquireSector(ctx, id, l.spt, existing, allocate, sealing)
|
2020-03-23 11:40:02 +00:00
|
|
|
|
|
|
|
return p, done, err
|
|
|
|
}
|