2020-03-23 11:40:02 +00:00
|
|
|
package sectorstorage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-03-24 18:00:08 +00:00
|
|
|
"errors"
|
2020-03-23 11:40:02 +00:00
|
|
|
"io"
|
|
|
|
"net/http"
|
2020-09-07 10:20:50 +00:00
|
|
|
"sync"
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-10-18 10:35:44 +00:00
|
|
|
"github.com/google/uuid"
|
2020-08-27 21:58:37 +00:00
|
|
|
"github.com/hashicorp/go-multierror"
|
2020-03-23 11:40:02 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
logging "github.com/ipfs/go-log/v2"
|
|
|
|
"github.com/mitchellh/go-homedir"
|
|
|
|
"golang.org/x/xerrors"
|
|
|
|
|
2020-09-07 03:49:10 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2020-09-30 17:32:19 +00:00
|
|
|
"github.com/filecoin-project/go-statestore"
|
2020-03-23 11:40:02 +00:00
|
|
|
"github.com/filecoin-project/specs-storage/storage"
|
|
|
|
|
2020-08-17 13:26:18 +00:00
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
2020-08-27 21:58:37 +00:00
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
2020-08-17 13:26:18 +00:00
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
|
|
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
2020-03-23 11:40:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var log = logging.Logger("advmgr")
|
|
|
|
|
2020-03-24 18:00:08 +00:00
|
|
|
var ErrNoWorkers = errors.New("no suitable workers found")
|
|
|
|
|
2020-03-23 11:40:02 +00:00
|
|
|
type URLs []string
|
|
|
|
|
|
|
|
type Worker interface {
|
2020-09-06 16:47:16 +00:00
|
|
|
storiface.WorkerCalls
|
2020-03-23 11:40:02 +00:00
|
|
|
|
|
|
|
TaskTypes(context.Context) (map[sealtasks.TaskType]struct{}, error)
|
|
|
|
|
|
|
|
// Returns paths accessible to the worker
|
|
|
|
Paths(context.Context) ([]stores.StoragePath, error)
|
|
|
|
|
2020-04-23 22:16:21 +00:00
|
|
|
Info(context.Context) (storiface.WorkerInfo, error)
|
2020-03-24 23:49:45 +00:00
|
|
|
|
2020-10-18 10:35:44 +00:00
|
|
|
Session(context.Context) (uuid.UUID, error)
|
2020-05-01 18:00:17 +00:00
|
|
|
|
2020-09-16 22:35:09 +00:00
|
|
|
Close() error // TODO: do we need this?
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type SectorManager interface {
|
|
|
|
SectorSize() abi.SectorSize
|
|
|
|
|
2020-05-26 08:25:17 +00:00
|
|
|
ReadPiece(context.Context, io.Writer, abi.SectorID, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) error
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
ffiwrapper.StorageSealer
|
2020-03-23 11:40:02 +00:00
|
|
|
storage.Prover
|
2020-09-07 14:12:46 +00:00
|
|
|
storiface.WorkerReturn
|
2020-05-16 21:03:29 +00:00
|
|
|
FaultTracker
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-10-18 10:35:44 +00:00
|
|
|
type WorkerID uuid.UUID // worker session UUID
|
|
|
|
var ClosedWorkerID = uuid.UUID{}
|
2020-03-23 11:40:02 +00:00
|
|
|
|
|
|
|
type Manager struct {
|
2020-03-26 02:50:56 +00:00
|
|
|
scfg *ffiwrapper.Config
|
2020-03-23 11:40:02 +00:00
|
|
|
|
|
|
|
ls stores.LocalStorage
|
|
|
|
storage *stores.Remote
|
|
|
|
localStore *stores.Local
|
|
|
|
remoteHnd *stores.FetchHandler
|
|
|
|
index stores.SectorIndex
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
sched *scheduler
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
storage.Prover
|
2020-09-07 10:20:50 +00:00
|
|
|
|
2020-09-16 22:35:30 +00:00
|
|
|
workLk sync.Mutex
|
|
|
|
work *statestore.StateStore
|
2020-09-16 15:08:05 +00:00
|
|
|
|
2020-09-16 22:35:09 +00:00
|
|
|
callToWork map[storiface.CallID]WorkID
|
2020-09-16 15:08:05 +00:00
|
|
|
// used when we get an early return and there's no callToWork mapping
|
|
|
|
callRes map[storiface.CallID]chan result
|
|
|
|
|
2020-09-16 22:35:09 +00:00
|
|
|
results map[WorkID]result
|
|
|
|
waitRes map[WorkID]chan struct{}
|
2020-09-07 10:20:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type result struct {
|
2020-09-07 14:12:46 +00:00
|
|
|
r interface{}
|
2020-09-07 10:20:50 +00:00
|
|
|
err error
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-27 20:08:06 +00:00
|
|
|
type SealerConfig struct {
|
2020-07-24 14:43:41 +00:00
|
|
|
ParallelFetchLimit int
|
|
|
|
|
2020-03-27 20:08:06 +00:00
|
|
|
// Local worker config
|
2020-08-17 09:39:29 +00:00
|
|
|
AllowAddPiece bool
|
2020-03-27 20:08:06 +00:00
|
|
|
AllowPreCommit1 bool
|
|
|
|
AllowPreCommit2 bool
|
|
|
|
AllowCommit bool
|
2020-05-14 01:01:38 +00:00
|
|
|
AllowUnseal bool
|
2020-03-27 20:08:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type StorageAuth http.Header
|
|
|
|
|
2020-09-14 07:44:55 +00:00
|
|
|
type WorkerStateStore *statestore.StateStore
|
2020-09-16 15:08:05 +00:00
|
|
|
type ManagerStateStore *statestore.StateStore
|
2020-09-14 07:44:55 +00:00
|
|
|
|
2020-09-16 15:08:05 +00:00
|
|
|
func New(ctx context.Context, ls stores.LocalStorage, si stores.SectorIndex, cfg *ffiwrapper.Config, sc SealerConfig, urls URLs, sa StorageAuth, wss WorkerStateStore, mss ManagerStateStore) (*Manager, error) {
|
2020-03-23 11:40:02 +00:00
|
|
|
lstor, err := stores.NewLocal(ctx, ls, si, urls)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2020-06-03 20:00:34 +00:00
|
|
|
prover, err := ffiwrapper.New(&readonlyProvider{stor: lstor, index: si}, cfg)
|
2020-03-23 11:40:02 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, xerrors.Errorf("creating prover instance: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-07-24 14:43:41 +00:00
|
|
|
stor := stores.NewRemote(lstor, si, http.Header(sa), sc.ParallelFetchLimit)
|
2020-03-23 11:40:02 +00:00
|
|
|
|
|
|
|
m := &Manager{
|
|
|
|
scfg: cfg,
|
|
|
|
|
|
|
|
ls: ls,
|
|
|
|
storage: stor,
|
|
|
|
localStore: lstor,
|
|
|
|
remoteHnd: &stores.FetchHandler{Local: lstor},
|
|
|
|
index: si,
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
sched: newScheduler(cfg.SealProofType),
|
2020-03-23 11:40:02 +00:00
|
|
|
|
|
|
|
Prover: prover,
|
2020-09-07 14:35:54 +00:00
|
|
|
|
2020-09-16 20:33:49 +00:00
|
|
|
work: mss,
|
2020-09-16 22:35:09 +00:00
|
|
|
callToWork: map[storiface.CallID]WorkID{},
|
2020-09-16 20:33:49 +00:00
|
|
|
callRes: map[storiface.CallID]chan result{},
|
2020-09-16 22:35:09 +00:00
|
|
|
results: map[WorkID]result{},
|
|
|
|
waitRes: map[WorkID]chan struct{}{},
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-09-16 22:35:09 +00:00
|
|
|
m.setupWorkTracker()
|
2020-09-16 15:08:05 +00:00
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
go m.sched.runSched()
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-03-24 19:38:00 +00:00
|
|
|
localTasks := []sealtasks.TaskType{
|
2020-08-17 09:39:29 +00:00
|
|
|
sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTReadUnsealed,
|
|
|
|
}
|
|
|
|
if sc.AllowAddPiece {
|
|
|
|
localTasks = append(localTasks, sealtasks.TTAddPiece)
|
2020-03-24 19:38:00 +00:00
|
|
|
}
|
2020-03-25 20:20:24 +00:00
|
|
|
if sc.AllowPreCommit1 {
|
|
|
|
localTasks = append(localTasks, sealtasks.TTPreCommit1)
|
|
|
|
}
|
|
|
|
if sc.AllowPreCommit2 {
|
|
|
|
localTasks = append(localTasks, sealtasks.TTPreCommit2)
|
|
|
|
}
|
|
|
|
if sc.AllowCommit {
|
|
|
|
localTasks = append(localTasks, sealtasks.TTCommit2)
|
|
|
|
}
|
2020-05-14 01:01:38 +00:00
|
|
|
if sc.AllowUnseal {
|
|
|
|
localTasks = append(localTasks, sealtasks.TTUnseal)
|
|
|
|
}
|
2020-03-24 19:38:00 +00:00
|
|
|
|
2020-03-23 11:40:02 +00:00
|
|
|
err = m.AddWorker(ctx, NewLocalWorker(WorkerConfig{
|
|
|
|
SealProof: cfg.SealProofType,
|
2020-03-24 19:38:00 +00:00
|
|
|
TaskTypes: localTasks,
|
2020-09-14 07:44:55 +00:00
|
|
|
}, stor, lstor, si, m, wss))
|
2020-03-23 11:40:02 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, xerrors.Errorf("adding local worker: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return m, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) AddLocalStorage(ctx context.Context, path string) error {
|
|
|
|
path, err := homedir.Expand(path)
|
|
|
|
if err != nil {
|
|
|
|
return xerrors.Errorf("expanding local path: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := m.localStore.OpenPath(ctx, path); err != nil {
|
|
|
|
return xerrors.Errorf("opening local path: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-03-27 20:08:06 +00:00
|
|
|
if err := m.ls.SetStorage(func(sc *stores.StorageConfig) {
|
|
|
|
sc.StoragePaths = append(sc.StoragePaths, stores.LocalPath{Path: path})
|
2020-03-23 11:40:02 +00:00
|
|
|
}); err != nil {
|
|
|
|
return xerrors.Errorf("get storage config: %w", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) AddWorker(ctx context.Context, w Worker) error {
|
2020-10-18 10:35:44 +00:00
|
|
|
return m.sched.runWorker(ctx, w)
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
|
|
m.remoteHnd.ServeHTTP(w, r)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) SectorSize() abi.SectorSize {
|
|
|
|
sz, _ := m.scfg.SealProofType.SectorSize()
|
|
|
|
return sz
|
|
|
|
}
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
func schedNop(context.Context, Worker) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-16 15:08:05 +00:00
|
|
|
func (m *Manager) schedFetch(sector abi.SectorID, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) func(context.Context, Worker) error {
|
2020-04-27 18:37:31 +00:00
|
|
|
return func(ctx context.Context, worker Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
_, err := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, ft, ptype, am))
|
2020-09-07 10:20:50 +00:00
|
|
|
return err
|
2020-04-27 18:37:31 +00:00
|
|
|
}
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-09-15 15:47:03 +00:00
|
|
|
func (m *Manager) readPiece(sink io.Writer, sector abi.SectorID, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, rok *bool) func(ctx context.Context, w Worker) error {
|
|
|
|
return func(ctx context.Context, w Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
r, err := m.waitSimpleCall(ctx)(w.ReadPiece(ctx, sink, sector, offset, size))
|
2020-09-15 15:47:03 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
*rok = r.(bool)
|
|
|
|
return nil
|
2020-04-27 18:37:31 +00:00
|
|
|
}
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-09-11 19:04:54 +00:00
|
|
|
func (m *Manager) tryReadUnsealedPiece(ctx context.Context, sink io.Writer, sector abi.SectorID, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (foundUnsealed bool, readOk bool, selector WorkerSelector, returnErr error) {
|
|
|
|
|
|
|
|
// acquire a lock purely for reading unsealed sectors
|
2020-06-03 20:00:34 +00:00
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-15 15:47:03 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTUnsealed, storiface.FTNone); err != nil {
|
2020-09-11 19:04:54 +00:00
|
|
|
returnErr = xerrors.Errorf("acquiring read sector lock: %w", err)
|
|
|
|
return
|
2020-06-03 20:00:34 +00:00
|
|
|
}
|
|
|
|
|
2020-08-11 07:27:03 +00:00
|
|
|
// passing 0 spt because we only need it when allowFetch is true
|
2020-09-06 16:54:00 +00:00
|
|
|
best, err := m.index.StorageFindSector(ctx, sector, storiface.FTUnsealed, 0, false)
|
2020-05-14 01:01:38 +00:00
|
|
|
if err != nil {
|
2020-09-11 19:04:54 +00:00
|
|
|
returnErr = xerrors.Errorf("read piece: checking for already existing unsealed sector: %w", err)
|
|
|
|
return
|
2020-09-07 10:20:50 +00:00
|
|
|
}
|
|
|
|
|
2020-09-11 19:04:54 +00:00
|
|
|
foundUnsealed = len(best) > 0
|
|
|
|
if foundUnsealed { // append to existing
|
2020-07-30 20:03:43 +00:00
|
|
|
// There is unsealed sector, see if we can read from it
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
selector = newExistingSelector(m.index, sector, storiface.FTUnsealed, false)
|
2020-07-30 20:03:43 +00:00
|
|
|
|
2020-09-16 20:33:49 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTReadUnsealed, selector, m.schedFetch(sector, storiface.FTUnsealed, storiface.PathSealing, storiface.AcquireMove),
|
2020-09-15 15:47:03 +00:00
|
|
|
m.readPiece(sink, sector, offset, size, &readOk))
|
2020-07-30 20:03:43 +00:00
|
|
|
if err != nil {
|
2020-09-11 19:04:54 +00:00
|
|
|
returnErr = xerrors.Errorf("reading piece from sealed sector: %w", err)
|
2020-07-30 20:03:43 +00:00
|
|
|
}
|
2020-09-11 19:04:54 +00:00
|
|
|
} else {
|
2020-09-15 15:47:03 +00:00
|
|
|
selector = newAllocSelector(m.index, storiface.FTUnsealed, storiface.PathSealing)
|
2020-09-11 19:04:54 +00:00
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
2020-07-30 20:03:43 +00:00
|
|
|
|
2020-09-11 19:04:54 +00:00
|
|
|
func (m *Manager) ReadPiece(ctx context.Context, sink io.Writer, sector abi.SectorID, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) error {
|
|
|
|
foundUnsealed, readOk, selector, err := m.tryReadUnsealedPiece(ctx, sink, sector, offset, size)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if readOk {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-15 15:47:03 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.FTUnsealed); err != nil {
|
2020-09-11 19:04:54 +00:00
|
|
|
return xerrors.Errorf("acquiring unseal sector lock: %w", err)
|
2020-07-30 20:03:43 +00:00
|
|
|
}
|
2020-05-14 01:01:38 +00:00
|
|
|
|
2020-05-20 16:36:46 +00:00
|
|
|
unsealFetch := func(ctx context.Context, worker Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
if _, err := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.PathSealing, storiface.AcquireCopy)); err != nil {
|
2020-05-20 16:36:46 +00:00
|
|
|
return xerrors.Errorf("copy sealed/cache sector data: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-09-11 19:04:54 +00:00
|
|
|
if foundUnsealed {
|
2020-09-16 20:33:49 +00:00
|
|
|
if _, err := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, storiface.FTUnsealed, storiface.PathSealing, storiface.AcquireMove)); err != nil {
|
2020-05-29 16:57:44 +00:00
|
|
|
return xerrors.Errorf("copy unsealed sector data: %w", err)
|
|
|
|
}
|
2020-05-20 16:36:46 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2020-05-14 01:01:38 +00:00
|
|
|
|
2020-09-08 10:33:36 +00:00
|
|
|
if unsealed == cid.Undef {
|
|
|
|
return xerrors.Errorf("cannot unseal piece (sector: %d, offset: %d size: %d) - unsealed cid is undefined", sector, offset, size)
|
|
|
|
}
|
2020-05-20 20:29:05 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTUnseal, selector, unsealFetch, func(ctx context.Context, w Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
// TODO: make restartable
|
|
|
|
_, err := m.waitSimpleCall(ctx)(w.UnsealPiece(ctx, sector, offset, size, ticket, unsealed))
|
2020-09-07 10:20:50 +00:00
|
|
|
return err
|
2020-05-14 01:01:38 +00:00
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
selector = newExistingSelector(m.index, sector, storiface.FTUnsealed, false)
|
2020-05-14 01:01:38 +00:00
|
|
|
|
2020-09-16 20:33:49 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTReadUnsealed, selector, m.schedFetch(sector, storiface.FTUnsealed, storiface.PathSealing, storiface.AcquireMove),
|
2020-09-15 15:47:03 +00:00
|
|
|
m.readPiece(sink, sector, offset, size, &readOk))
|
2020-05-14 01:01:38 +00:00
|
|
|
if err != nil {
|
|
|
|
return xerrors.Errorf("reading piece from sealed sector: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-09-08 11:50:56 +00:00
|
|
|
if !readOk {
|
2020-07-30 20:03:43 +00:00
|
|
|
return xerrors.Errorf("failed to read unsealed piece")
|
|
|
|
}
|
|
|
|
|
2020-05-14 01:01:38 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-03-23 11:40:02 +00:00
|
|
|
func (m *Manager) NewSector(ctx context.Context, sector abi.SectorID) error {
|
|
|
|
log.Warnf("stub NewSector")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) AddPiece(ctx context.Context, sector abi.SectorID, existingPieces []abi.UnpaddedPieceSize, sz abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) {
|
2020-06-03 20:00:34 +00:00
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTNone, storiface.FTUnsealed); err != nil {
|
2020-06-03 20:00:34 +00:00
|
|
|
return abi.PieceInfo{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
var selector WorkerSelector
|
2020-03-23 11:40:02 +00:00
|
|
|
var err error
|
|
|
|
if len(existingPieces) == 0 { // new
|
2020-09-06 16:54:00 +00:00
|
|
|
selector = newAllocSelector(m.index, storiface.FTUnsealed, storiface.PathSealing)
|
2020-05-14 01:01:38 +00:00
|
|
|
} else { // use existing
|
2020-09-06 16:54:00 +00:00
|
|
|
selector = newExistingSelector(m.index, sector, storiface.FTUnsealed, false)
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
var out abi.PieceInfo
|
2020-05-13 23:56:21 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTAddPiece, selector, schedNop, func(ctx context.Context, w Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
p, err := m.waitSimpleCall(ctx)(w.AddPiece(ctx, sector, existingPieces, sz, r))
|
2020-04-27 18:37:31 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-09-07 10:20:50 +00:00
|
|
|
out = p.(abi.PieceInfo)
|
2020-04-27 18:37:31 +00:00
|
|
|
return nil
|
|
|
|
})
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
return out, err
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) SealPreCommit1(ctx context.Context, sector abi.SectorID, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) {
|
2020-06-03 20:00:34 +00:00
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-30 15:26:09 +00:00
|
|
|
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTPreCommit1, sector, ticket, pieces)
|
2020-09-16 15:08:05 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, xerrors.Errorf("getWork: %w", err)
|
|
|
|
}
|
2020-09-30 15:26:09 +00:00
|
|
|
defer cancel()
|
2020-09-16 15:08:05 +00:00
|
|
|
|
2020-09-30 15:48:48 +00:00
|
|
|
var waitErr error
|
2020-09-16 15:08:05 +00:00
|
|
|
waitRes := func() {
|
|
|
|
p, werr := m.waitWork(ctx, wk)
|
|
|
|
if werr != nil {
|
2020-09-30 15:48:48 +00:00
|
|
|
waitErr = werr
|
2020-09-16 15:08:05 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
out = p.(storage.PreCommit1Out)
|
|
|
|
}
|
|
|
|
|
|
|
|
if wait { // already in progress
|
|
|
|
waitRes()
|
2020-09-30 16:16:07 +00:00
|
|
|
return out, waitErr
|
2020-09-16 15:08:05 +00:00
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTUnsealed, storiface.FTSealed|storiface.FTCache); err != nil {
|
2020-06-03 20:00:34 +00:00
|
|
|
return nil, xerrors.Errorf("acquiring sector lock: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-03-23 11:40:02 +00:00
|
|
|
// TODO: also consider where the unsealed data sits
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
selector := newAllocSelector(m.index, storiface.FTCache|storiface.FTSealed, storiface.PathSealing)
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-09-16 15:08:05 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTPreCommit1, selector, m.schedFetch(sector, storiface.FTUnsealed, storiface.PathSealing, storiface.AcquireMove), func(ctx context.Context, w Worker) error {
|
|
|
|
err := m.startWork(ctx, wk)(w.SealPreCommit1(ctx, sector, ticket, pieces))
|
2020-04-27 18:37:31 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-09-16 15:08:05 +00:00
|
|
|
|
2020-09-16 20:33:49 +00:00
|
|
|
waitRes()
|
2020-04-27 18:37:31 +00:00
|
|
|
return nil
|
|
|
|
})
|
2020-09-30 15:48:48 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-09-30 15:48:48 +00:00
|
|
|
return out, waitErr
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
func (m *Manager) SealPreCommit2(ctx context.Context, sector abi.SectorID, phase1Out storage.PreCommit1Out) (out storage.SectorCids, err error) {
|
2020-06-03 20:00:34 +00:00
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-30 15:26:09 +00:00
|
|
|
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTPreCommit2, sector, phase1Out)
|
2020-09-16 20:33:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return storage.SectorCids{}, xerrors.Errorf("getWork: %w", err)
|
|
|
|
}
|
2020-09-30 15:26:09 +00:00
|
|
|
defer cancel()
|
2020-09-16 20:33:49 +00:00
|
|
|
|
2020-09-30 15:48:48 +00:00
|
|
|
var waitErr error
|
2020-09-16 20:33:49 +00:00
|
|
|
waitRes := func() {
|
|
|
|
p, werr := m.waitWork(ctx, wk)
|
|
|
|
if werr != nil {
|
2020-09-30 15:48:48 +00:00
|
|
|
waitErr = werr
|
2020-09-16 20:33:49 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
out = p.(storage.SectorCids)
|
|
|
|
}
|
|
|
|
|
|
|
|
if wait { // already in progress
|
|
|
|
waitRes()
|
2020-09-30 16:16:07 +00:00
|
|
|
return out, waitErr
|
2020-09-16 20:33:49 +00:00
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTSealed, storiface.FTCache); err != nil {
|
2020-06-03 20:00:34 +00:00
|
|
|
return storage.SectorCids{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
selector := newExistingSelector(m.index, sector, storiface.FTCache|storiface.FTSealed, true)
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-09-16 20:33:49 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTPreCommit2, selector, m.schedFetch(sector, storiface.FTCache|storiface.FTSealed, storiface.PathSealing, storiface.AcquireMove), func(ctx context.Context, w Worker) error {
|
|
|
|
err := m.startWork(ctx, wk)(w.SealPreCommit2(ctx, sector, phase1Out))
|
2020-04-27 18:37:31 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-09-16 20:33:49 +00:00
|
|
|
|
|
|
|
waitRes()
|
2020-04-27 18:37:31 +00:00
|
|
|
return nil
|
|
|
|
})
|
2020-09-30 15:48:48 +00:00
|
|
|
if err != nil {
|
|
|
|
return storage.SectorCids{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return out, waitErr
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
func (m *Manager) SealCommit1(ctx context.Context, sector abi.SectorID, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (out storage.Commit1Out, err error) {
|
2020-06-03 20:00:34 +00:00
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-30 15:26:09 +00:00
|
|
|
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTCommit1, sector, ticket, seed, pieces, cids)
|
2020-09-16 20:33:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return storage.Commit1Out{}, xerrors.Errorf("getWork: %w", err)
|
|
|
|
}
|
2020-09-30 15:26:09 +00:00
|
|
|
defer cancel()
|
2020-09-16 20:33:49 +00:00
|
|
|
|
2020-09-30 15:48:48 +00:00
|
|
|
var waitErr error
|
2020-09-16 20:33:49 +00:00
|
|
|
waitRes := func() {
|
|
|
|
p, werr := m.waitWork(ctx, wk)
|
|
|
|
if werr != nil {
|
2020-09-30 15:48:48 +00:00
|
|
|
waitErr = werr
|
2020-09-16 20:33:49 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
out = p.(storage.Commit1Out)
|
|
|
|
}
|
|
|
|
|
|
|
|
if wait { // already in progress
|
|
|
|
waitRes()
|
2020-09-30 16:16:07 +00:00
|
|
|
return out, waitErr
|
2020-09-16 20:33:49 +00:00
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTSealed, storiface.FTCache); err != nil {
|
2020-06-03 20:00:34 +00:00
|
|
|
return storage.Commit1Out{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-06-03 19:21:27 +00:00
|
|
|
// NOTE: We set allowFetch to false in so that we always execute on a worker
|
|
|
|
// with direct access to the data. We want to do that because this step is
|
|
|
|
// generally very cheap / fast, and transferring data is not worth the effort
|
2020-09-06 16:54:00 +00:00
|
|
|
selector := newExistingSelector(m.index, sector, storiface.FTCache|storiface.FTSealed, false)
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-09-16 20:33:49 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTCommit1, selector, m.schedFetch(sector, storiface.FTCache|storiface.FTSealed, storiface.PathSealing, storiface.AcquireMove), func(ctx context.Context, w Worker) error {
|
|
|
|
err := m.startWork(ctx, wk)(w.SealCommit1(ctx, sector, ticket, seed, pieces, cids))
|
2020-04-27 18:37:31 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-09-16 20:33:49 +00:00
|
|
|
|
|
|
|
waitRes()
|
2020-04-27 18:37:31 +00:00
|
|
|
return nil
|
|
|
|
})
|
2020-09-30 15:48:48 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return out, waitErr
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
func (m *Manager) SealCommit2(ctx context.Context, sector abi.SectorID, phase1Out storage.Commit1Out) (out storage.Proof, err error) {
|
2020-09-30 15:26:09 +00:00
|
|
|
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTCommit2, sector, phase1Out)
|
2020-09-16 20:33:49 +00:00
|
|
|
if err != nil {
|
|
|
|
return storage.Proof{}, xerrors.Errorf("getWork: %w", err)
|
|
|
|
}
|
2020-09-30 15:26:09 +00:00
|
|
|
defer cancel()
|
2020-09-16 20:33:49 +00:00
|
|
|
|
2020-09-30 15:48:48 +00:00
|
|
|
var waitErr error
|
2020-09-16 20:33:49 +00:00
|
|
|
waitRes := func() {
|
|
|
|
p, werr := m.waitWork(ctx, wk)
|
|
|
|
if werr != nil {
|
2020-09-30 15:48:48 +00:00
|
|
|
waitErr = werr
|
2020-09-16 20:33:49 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
out = p.(storage.Proof)
|
|
|
|
}
|
|
|
|
|
|
|
|
if wait { // already in progress
|
|
|
|
waitRes()
|
2020-09-30 16:16:07 +00:00
|
|
|
return out, waitErr
|
2020-09-16 20:33:49 +00:00
|
|
|
}
|
|
|
|
|
2020-04-27 18:37:31 +00:00
|
|
|
selector := newTaskSelector()
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-05-13 23:56:21 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTCommit2, selector, schedNop, func(ctx context.Context, w Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
err := m.startWork(ctx, wk)(w.SealCommit2(ctx, sector, phase1Out))
|
2020-03-23 11:40:02 +00:00
|
|
|
if err != nil {
|
2020-04-27 18:37:31 +00:00
|
|
|
return err
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
2020-09-16 20:33:49 +00:00
|
|
|
|
|
|
|
waitRes()
|
2020-04-27 18:37:31 +00:00
|
|
|
return nil
|
|
|
|
})
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-09-30 15:48:48 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return out, waitErr
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-06-22 15:02:59 +00:00
|
|
|
func (m *Manager) FinalizeSector(ctx context.Context, sector abi.SectorID, keepUnsealed []storage.Range) error {
|
2020-06-03 20:00:34 +00:00
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTNone, storiface.FTSealed|storiface.FTUnsealed|storiface.FTCache); err != nil {
|
2020-06-03 20:00:34 +00:00
|
|
|
return xerrors.Errorf("acquiring sector lock: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
unsealed := storiface.FTUnsealed
|
2020-06-04 19:15:15 +00:00
|
|
|
{
|
2020-09-06 16:54:00 +00:00
|
|
|
unsealedStores, err := m.index.StorageFindSector(ctx, sector, storiface.FTUnsealed, 0, false)
|
2020-06-04 19:15:15 +00:00
|
|
|
if err != nil {
|
|
|
|
return xerrors.Errorf("finding unsealed sector: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(unsealedStores) == 0 { // Is some edge-cases unsealed sector may not exist already, that's fine
|
2020-09-06 16:54:00 +00:00
|
|
|
unsealed = storiface.FTNone
|
2020-06-04 19:15:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
selector := newExistingSelector(m.index, sector, storiface.FTCache|storiface.FTSealed, false)
|
2020-03-23 11:40:02 +00:00
|
|
|
|
2020-08-05 12:36:49 +00:00
|
|
|
err := m.sched.Schedule(ctx, sector, sealtasks.TTFinalize, selector,
|
2020-09-16 20:33:49 +00:00
|
|
|
m.schedFetch(sector, storiface.FTCache|storiface.FTSealed|unsealed, storiface.PathSealing, storiface.AcquireMove),
|
2020-04-27 18:37:31 +00:00
|
|
|
func(ctx context.Context, w Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
_, err := m.waitSimpleCall(ctx)(w.FinalizeSector(ctx, sector, keepUnsealed))
|
2020-09-07 10:20:50 +00:00
|
|
|
return err
|
2020-04-27 18:37:31 +00:00
|
|
|
})
|
2020-06-03 21:44:59 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
fetchSel := newAllocSelector(m.index, storiface.FTCache|storiface.FTSealed, storiface.PathStorage)
|
2020-06-22 15:02:59 +00:00
|
|
|
moveUnsealed := unsealed
|
|
|
|
{
|
|
|
|
if len(keepUnsealed) == 0 {
|
2020-09-06 16:54:00 +00:00
|
|
|
moveUnsealed = storiface.FTNone
|
2020-06-22 15:02:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-03 21:44:59 +00:00
|
|
|
err = m.sched.Schedule(ctx, sector, sealtasks.TTFetch, fetchSel,
|
2020-09-16 20:33:49 +00:00
|
|
|
m.schedFetch(sector, storiface.FTCache|storiface.FTSealed|moveUnsealed, storiface.PathStorage, storiface.AcquireMove),
|
2020-06-03 21:44:59 +00:00
|
|
|
func(ctx context.Context, w Worker) error {
|
2020-09-16 20:33:49 +00:00
|
|
|
_, err := m.waitSimpleCall(ctx)(w.MoveStorage(ctx, sector, storiface.FTCache|storiface.FTSealed|moveUnsealed))
|
2020-09-07 10:20:50 +00:00
|
|
|
return err
|
2020-06-03 21:44:59 +00:00
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
return xerrors.Errorf("moving sector to storage: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
2020-03-23 11:40:02 +00:00
|
|
|
}
|
|
|
|
|
2020-06-22 15:02:59 +00:00
|
|
|
func (m *Manager) ReleaseUnsealed(ctx context.Context, sector abi.SectorID, safeToFree []storage.Range) error {
|
2020-07-03 20:23:36 +00:00
|
|
|
log.Warnw("ReleaseUnsealed todo")
|
|
|
|
return nil
|
2020-06-22 15:02:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) Remove(ctx context.Context, sector abi.SectorID) error {
|
|
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
if err := m.index.StorageLock(ctx, sector, storiface.FTNone, storiface.FTSealed|storiface.FTUnsealed|storiface.FTCache); err != nil {
|
2020-06-22 15:02:59 +00:00
|
|
|
return xerrors.Errorf("acquiring sector lock: %w", err)
|
|
|
|
}
|
|
|
|
|
2020-08-27 21:58:37 +00:00
|
|
|
var err error
|
2020-06-22 15:02:59 +00:00
|
|
|
|
2020-09-06 16:54:00 +00:00
|
|
|
if rerr := m.storage.Remove(ctx, sector, storiface.FTSealed, true); rerr != nil {
|
2020-08-27 21:58:37 +00:00
|
|
|
err = multierror.Append(err, xerrors.Errorf("removing sector (sealed): %w", rerr))
|
|
|
|
}
|
2020-09-06 16:54:00 +00:00
|
|
|
if rerr := m.storage.Remove(ctx, sector, storiface.FTCache, true); rerr != nil {
|
2020-08-27 21:58:37 +00:00
|
|
|
err = multierror.Append(err, xerrors.Errorf("removing sector (cache): %w", rerr))
|
|
|
|
}
|
2020-09-06 16:54:00 +00:00
|
|
|
if rerr := m.storage.Remove(ctx, sector, storiface.FTUnsealed, true); rerr != nil {
|
2020-08-27 21:58:37 +00:00
|
|
|
err = multierror.Append(err, xerrors.Errorf("removing sector (unsealed): %w", rerr))
|
2020-06-22 15:02:59 +00:00
|
|
|
}
|
|
|
|
|
2020-08-27 21:58:37 +00:00
|
|
|
return err
|
2020-06-22 15:02:59 +00:00
|
|
|
}
|
|
|
|
|
2020-09-07 10:20:50 +00:00
|
|
|
func (m *Manager) ReturnAddPiece(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err string) error {
|
|
|
|
return m.returnResult(callID, pi, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storage.PreCommit1Out, err string) error {
|
|
|
|
return m.returnResult(callID, p1o, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storage.SectorCids, err string) error {
|
|
|
|
return m.returnResult(callID, sealed, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storage.Commit1Out, err string) error {
|
|
|
|
return m.returnResult(callID, out, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storage.Proof, err string) error {
|
|
|
|
return m.returnResult(callID, proof, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnFinalizeSector(ctx context.Context, callID storiface.CallID, err string) error {
|
|
|
|
return m.returnResult(callID, nil, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnReleaseUnsealed(ctx context.Context, callID storiface.CallID, err string) error {
|
|
|
|
return m.returnResult(callID, nil, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnMoveStorage(ctx context.Context, callID storiface.CallID, err string) error {
|
|
|
|
return m.returnResult(callID, nil, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnUnsealPiece(ctx context.Context, callID storiface.CallID, err string) error {
|
|
|
|
return m.returnResult(callID, nil, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnReadPiece(ctx context.Context, callID storiface.CallID, ok bool, err string) error {
|
|
|
|
return m.returnResult(callID, ok, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Manager) ReturnFetch(ctx context.Context, callID storiface.CallID, err string) error {
|
|
|
|
return m.returnResult(callID, nil, err)
|
|
|
|
}
|
|
|
|
|
2020-03-23 11:40:02 +00:00
|
|
|
func (m *Manager) StorageLocal(ctx context.Context) (map[stores.ID]string, error) {
|
|
|
|
l, err := m.localStore.Local(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
out := map[stores.ID]string{}
|
|
|
|
for _, st := range l {
|
|
|
|
out[st.ID] = st.LocalPath
|
|
|
|
}
|
|
|
|
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-07-08 14:58:09 +00:00
|
|
|
func (m *Manager) FsStat(ctx context.Context, id stores.ID) (fsutil.FsStat, error) {
|
2020-03-23 22:43:38 +00:00
|
|
|
return m.storage.FsStat(ctx, id)
|
|
|
|
}
|
|
|
|
|
2020-07-27 10:17:09 +00:00
|
|
|
func (m *Manager) SchedDiag(ctx context.Context) (interface{}, error) {
|
|
|
|
return m.sched.Info(ctx)
|
|
|
|
}
|
|
|
|
|
2020-07-17 10:59:12 +00:00
|
|
|
func (m *Manager) Close(ctx context.Context) error {
|
|
|
|
return m.sched.Close(ctx)
|
2020-03-24 23:49:45 +00:00
|
|
|
}
|
|
|
|
|
2020-03-23 11:40:02 +00:00
|
|
|
var _ SectorManager = &Manager{}
|