Documentation ¶
Index ¶
- Constants
- Variables
- type DefaultPartialFileHandler
- func (d *DefaultPartialFileHandler) Close(pf *partialfile.PartialFile) error
- func (d *DefaultPartialFileHandler) HasAllocated(pf *partialfile.PartialFile, offset storiface.UnpaddedByteIndex, ...) (bool, error)
- func (d *DefaultPartialFileHandler) OpenPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialfile.PartialFile, error)
- func (d *DefaultPartialFileHandler) Reader(pf *partialfile.PartialFile, offset storiface.PaddedByteIndex, ...) (*os.File, error)
- type FetchHandler
- type Index
- func (i *Index) FindSector(id abi.SectorID, typ storiface.SectorFileType) ([]storiface.ID, error)
- func (i *Index) StorageAttach(ctx context.Context, si storiface.StorageInfo, st fsutil.FsStat) error
- func (i *Index) StorageBestAlloc(ctx context.Context, allocate storiface.SectorFileType, ssize abi.SectorSize, ...) ([]storiface.StorageInfo, error)
- func (i *Index) StorageDeclareSector(ctx context.Context, storageID storiface.ID, s abi.SectorID, ...) error
- func (i *Index) StorageDropSector(ctx context.Context, storageID storiface.ID, s abi.SectorID, ...) error
- func (i *Index) StorageFindSector(ctx context.Context, s abi.SectorID, ft storiface.SectorFileType, ...) ([]storiface.SectorStorageInfo, error)
- func (i Index) StorageGetLocks(context.Context) (storiface.SectorLocks, error)
- func (i *Index) StorageInfo(ctx context.Context, id storiface.ID) (storiface.StorageInfo, error)
- func (i *Index) StorageList(ctx context.Context) (map[storiface.ID][]storiface.Decl, error)
- func (i Index) StorageLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, ...) error
- func (i *Index) StorageReportHealth(ctx context.Context, id storiface.ID, report storiface.HealthReport) error
- func (i Index) StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, ...) (bool, error)
- type Local
- func (st *Local) AcquireSector(ctx context.Context, sid storage.SectorRef, existing storiface.SectorFileType, ...) (storiface.SectorPaths, storiface.SectorPaths, error)
- func (st *Local) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error)
- func (st *Local) GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, si storiface.PostSectorChallenge, ...) ([]byte, error)
- func (st *Local) Local(ctx context.Context) ([]storiface.StoragePath, error)
- func (st *Local) MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error
- func (st *Local) OpenPath(ctx context.Context, p string) error
- func (st *Local) Redeclare(ctx context.Context) error
- func (st *Local) Remove(ctx context.Context, sid abi.SectorID, typ storiface.SectorFileType, ...) error
- func (st *Local) RemoveCopies(ctx context.Context, sid abi.SectorID, typ storiface.SectorFileType) error
- func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, ...) (func(), error)
- type LocalPath
- type LocalStorage
- type LocalStorageMeta
- type PartialFileHandler
- type Remote
- func (r *Remote) AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, ...) (storiface.SectorPaths, storiface.SectorPaths, error)
- func (r *Remote) CheckIsUnsealed(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (bool, error)
- func (r *Remote) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error)
- func (r *Remote) GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, sinfo storiface.PostSectorChallenge, ...) ([]byte, error)
- func (r *Remote) MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error
- func (r *Remote) Reader(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (func(startOffsetAligned storiface.PaddedByteIndex) (io.ReadCloser, error), ...)
- func (r *Remote) Remove(ctx context.Context, sid abi.SectorID, typ storiface.SectorFileType, ...) error
- func (r *Remote) RemoveCopies(ctx context.Context, s abi.SectorID, typ storiface.SectorFileType) error
- func (r *Remote) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, ...) (func(), error)
- type SectorIndex
- type SingleVanillaParams
- type StorageConfig
- type Store
- type URLs
Constants ¶
const MetaFile = "sectorstore.json"
Variables ¶
var CopyBuf = 1 << 20
var FetchTempSubdir = "fetching"
var HeartbeatInterval = 10 * time.Second
var SkippedHeartbeatThresh = HeartbeatInterval * 5
Functions ¶
This section is empty.
Types ¶
type DefaultPartialFileHandler ¶ added in v1.11.0
type DefaultPartialFileHandler struct{}
DefaultPartialFileHandler is the default implementation of the PartialFileHandler interface. This is probably the only implementation we'll ever use because the purpose of the interface to is to mock out partial file related functionality during testing.
func (*DefaultPartialFileHandler) Close ¶ added in v1.11.0
func (d *DefaultPartialFileHandler) Close(pf *partialfile.PartialFile) error
Close closes the partial file
func (*DefaultPartialFileHandler) HasAllocated ¶ added in v1.11.0
func (d *DefaultPartialFileHandler) HasAllocated(pf *partialfile.PartialFile, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error)
func (*DefaultPartialFileHandler) OpenPartialFile ¶ added in v1.11.0
func (d *DefaultPartialFileHandler) OpenPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialfile.PartialFile, error)
func (*DefaultPartialFileHandler) Reader ¶ added in v1.11.0
func (d *DefaultPartialFileHandler) Reader(pf *partialfile.PartialFile, offset storiface.PaddedByteIndex, size abi.PaddedPieceSize) (*os.File, error)
type FetchHandler ¶
type FetchHandler struct { Local Store PfHandler PartialFileHandler }
func (*FetchHandler) ServeHTTP ¶
func (handler *FetchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) FindSector ¶
func (*Index) StorageAttach ¶
func (*Index) StorageBestAlloc ¶
func (i *Index) StorageBestAlloc(ctx context.Context, allocate storiface.SectorFileType, ssize abi.SectorSize, pathType storiface.PathType) ([]storiface.StorageInfo, error)
func (*Index) StorageDeclareSector ¶
func (*Index) StorageDropSector ¶
func (*Index) StorageFindSector ¶
func (i *Index) StorageFindSector(ctx context.Context, s abi.SectorID, ft storiface.SectorFileType, ssize abi.SectorSize, allowFetch bool) ([]storiface.SectorStorageInfo, error)
func (Index) StorageGetLocks ¶ added in v1.14.0
func (i Index) StorageGetLocks(context.Context) (storiface.SectorLocks, error)
func (*Index) StorageInfo ¶
func (*Index) StorageList ¶
func (Index) StorageLock ¶
func (i Index) StorageLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) error
func (*Index) StorageReportHealth ¶
func (Index) StorageTryLock ¶
func (i Index) StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) (bool, error)
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
func NewLocal ¶
func NewLocal(ctx context.Context, ls LocalStorage, index SectorIndex, urls []string) (*Local, error)
func (*Local) AcquireSector ¶
func (st *Local) AcquireSector(ctx context.Context, sid storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error)
func (*Local) GenerateSingleVanillaProof ¶ added in v1.15.2
func (*Local) MoveStorage ¶
func (*Local) RemoveCopies ¶
func (*Local) Reserve ¶
func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error)
type LocalStorage ¶
type LocalStorageMeta ¶
type LocalStorageMeta struct { ID storiface.ID // A high weight means data is more likely to be stored in this path Weight uint64 // 0 = readonly // Intermediate data for the sealing process will be stored here CanSeal bool // Finalized sectors that will be proved over time will be stored here CanStore bool // MaxStorage specifies the maximum number of bytes to use for sector storage // (0 = unlimited) MaxStorage uint64 // List of storage groups this path belongs to Groups []string // List of storage groups to which data from this path can be moved. If none // are specified, allow to all AllowTo []string }
LocalStorageMeta path/sectorstore.json
type PartialFileHandler ¶ added in v1.13.1
type PartialFileHandler interface { // OpenPartialFile opens and returns a partial file at the given path and also verifies it has the given // size OpenPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialfile.PartialFile, error) // HasAllocated returns true if the given partial file has an unsealed piece starting at the given offset with the given size. // returns false otherwise. HasAllocated(pf *partialfile.PartialFile, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) // Reader returns a file from which we can read the unsealed piece in the partial file. Reader(pf *partialfile.PartialFile, offset storiface.PaddedByteIndex, size abi.PaddedPieceSize) (*os.File, error) // Close closes the partial file Close(pf *partialfile.PartialFile) error }
PartialFileHandler helps mock out the partial file functionality during testing.
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
func NewRemote ¶
func NewRemote(local Store, index SectorIndex, auth http.Header, fetchLimit int, pfHandler PartialFileHandler) *Remote
func (*Remote) AcquireSector ¶
func (r *Remote) AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error)
func (*Remote) CheckIsUnsealed ¶ added in v1.11.0
func (r *Remote) CheckIsUnsealed(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (bool, error)
CheckIsUnsealed checks if we have an unsealed piece at the given offset in an already unsealed sector file for the given piece either locally or on any of the workers. Returns true if we have the unsealed piece, false otherwise.
func (*Remote) GenerateSingleVanillaProof ¶ added in v1.15.2
func (*Remote) MoveStorage ¶
func (*Remote) Reader ¶ added in v1.11.0
func (r *Remote) Reader(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (func(startOffsetAligned storiface.PaddedByteIndex) (io.ReadCloser, error), error)
Reader returns a reader for an unsealed piece at the given offset in the given sector. If the Miner has the unsealed piece locally, it will return a reader that reads from the local copy. If the Miner does NOT have the unsealed piece locally, it will query all workers that have the unsealed sector file to know if they have the unsealed piece and will then read the unsealed piece data from a worker that has it.
Returns a nil reader if : 1. no worker(local worker included) has an unsealed file for the given sector OR 2. no worker(local worker included) has the unsealed piece in their unsealed sector file. Will return a nil reader and a nil error in such a case.
func (*Remote) RemoveCopies ¶
func (*Remote) Reserve ¶ added in v1.11.0
func (r *Remote) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error)
type SectorIndex ¶
type SectorIndex interface { StorageAttach(context.Context, storiface.StorageInfo, fsutil.FsStat) error StorageInfo(context.Context, storiface.ID) (storiface.StorageInfo, error) StorageReportHealth(context.Context, storiface.ID, storiface.HealthReport) error StorageDeclareSector(ctx context.Context, storageID storiface.ID, s abi.SectorID, ft storiface.SectorFileType, primary bool) error StorageDropSector(ctx context.Context, storageID storiface.ID, s abi.SectorID, ft storiface.SectorFileType) error StorageFindSector(ctx context.Context, sector abi.SectorID, ft storiface.SectorFileType, ssize abi.SectorSize, allowFetch bool) ([]storiface.SectorStorageInfo, error) StorageBestAlloc(ctx context.Context, allocate storiface.SectorFileType, ssize abi.SectorSize, pathType storiface.PathType) ([]storiface.StorageInfo, error) // atomically acquire locks on all sector file types. close ctx to unlock StorageLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) error StorageTryLock(ctx context.Context, sector abi.SectorID, read storiface.SectorFileType, write storiface.SectorFileType) (bool, error) StorageGetLocks(ctx context.Context) (storiface.SectorLocks, error) StorageList(ctx context.Context) (map[storiface.ID][]storiface.Decl, error) }
type SingleVanillaParams ¶ added in v1.15.2
type SingleVanillaParams struct { Miner abi.ActorID Sector storiface.PostSectorChallenge ProofType abi.RegisteredPoStProof }
type StorageConfig ¶
type StorageConfig struct {
StoragePaths []LocalPath
}
StorageConfig .lotusstorage/storage.json
type Store ¶
type Store interface { AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType, op storiface.AcquireMode) (paths storiface.SectorPaths, stores storiface.SectorPaths, err error) Remove(ctx context.Context, s abi.SectorID, types storiface.SectorFileType, force bool, keepIn []storiface.ID) error // like remove, but doesn't remove the primary sector copy, nor the last // non-primary copy if there no primary copies RemoveCopies(ctx context.Context, s abi.SectorID, types storiface.SectorFileType) error // move sectors into storage MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, si storiface.PostSectorChallenge, ppt abi.RegisteredPoStProof) ([]byte, error) }