stores: 'None' file type
This commit is contained in:
parent
00cfb3bdcf
commit
05f52b1fad
@ -15,7 +15,7 @@ type readonlyProvider struct {
|
||||
}
|
||||
|
||||
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 { // 0 - don't allocate anything
|
||||
if allocate != stores.FTNone {
|
||||
return sectorbuilder.SectorPaths{}, nil, xerrors.New("read-only storage")
|
||||
}
|
||||
|
||||
|
8
storage/sectorstorage/stores/filetype.go
Normal file
8
storage/sectorstorage/stores/filetype.go
Normal file
@ -0,0 +1,8 @@
|
||||
package stores
|
||||
|
||||
import "github.com/filecoin-project/go-sectorbuilder"
|
||||
|
||||
const (
|
||||
// TODO: move the other types here after we drop go-sectorbuilder
|
||||
FTNone sectorbuilder.SectorFileType = 0
|
||||
)
|
@ -71,7 +71,7 @@ func (handler *FetchHandler) remoteGetSector(w http.ResponseWriter, r *http.Requ
|
||||
w.WriteHeader(500)
|
||||
return
|
||||
}
|
||||
paths, _, done, err := handler.Local.AcquireSector(r.Context(), id, ft, 0, false)
|
||||
paths, _, done, err := handler.Local.AcquireSector(r.Context(), id, ft, FTNone, false)
|
||||
if err != nil {
|
||||
log.Error("%+v", err)
|
||||
w.WriteHeader(500)
|
||||
|
@ -310,13 +310,13 @@ func (st *Local) Remove(ctx context.Context, sid abi.SectorID, typ sectorbuilder
|
||||
}
|
||||
|
||||
func (st *Local) MoveStorage(ctx context.Context, s abi.SectorID, types sectorbuilder.SectorFileType) error {
|
||||
dest, destIds, sdone, err := st.AcquireSector(ctx, s, 0, types, false)
|
||||
dest, destIds, sdone, err := st.AcquireSector(ctx, s, FTNone, types, false)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("acquire dest storage: %w", err)
|
||||
}
|
||||
defer sdone()
|
||||
|
||||
src, srcIds, ddone, err := st.AcquireSector(ctx, s, types, 0, false)
|
||||
src, srcIds, ddone, err := st.AcquireSector(ctx, s, types, FTNone, false)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("acquire src storage: %w", err)
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ func (r *Remote) acquireFromRemote(ctx context.Context, s abi.SectorID, fileType
|
||||
return si[i].Weight < si[j].Weight
|
||||
})
|
||||
|
||||
apaths, ids, done, err := r.local.AcquireSector(ctx, s, 0, fileType, sealing)
|
||||
apaths, ids, done, err := r.local.AcquireSector(ctx, s, FTNone, fileType, sealing)
|
||||
if err != nil {
|
||||
return "", "", "", nil, xerrors.Errorf("allocate local sector for fetching: %w", err)
|
||||
}
|
||||
@ -178,7 +178,7 @@ func (r *Remote) fetch(ctx context.Context, url, outname string) error {
|
||||
|
||||
func (r *Remote) MoveStorage(ctx context.Context, s abi.SectorID, types sectorbuilder.SectorFileType) error {
|
||||
// Make sure we have the data local
|
||||
_, _, ddone, err := r.AcquireSector(ctx, s, types, 0, false)
|
||||
_, _, ddone, err := r.AcquireSector(ctx, s, types, FTNone, false)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("acquire src storage (remote): %w", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user