Documentation ¶
Index ¶
- type Opts
- type PieceManager
- type PieceManagerImpl
- func (mgr *PieceManagerImpl) Import(ctx context.Context, path string) (cid.Cid, error)
- func (mgr *PieceManagerImpl) ImportCar(ctx context.Context, path string) (cid.Cid, error)
- func (mgr *PieceManagerImpl) ImportSector(ctx context.Context, path string, copy bool) ([]cid.Cid, error)
- func (mgr *PieceManagerImpl) Inspect(ctx context.Context, id cid.Cid) (bool, string, int, uint64, bool, error)
- func (mgr *PieceManagerImpl) LinkSystem() ipld.LinkSystem
- func (mgr *PieceManagerImpl) ListImported(ctx context.Context) (<-chan cid.Cid, <-chan error)
- func (mgr *PieceManagerImpl) Remove(ctx context.Context, id cid.Cid) error
- func (mgr *PieceManagerImpl) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct { // The datastore path of the piece info store. PsPath string // The datastore path of the block store. BsPath string // The datastore path of the block reference store. BrefsPath string }
Opts is the options for piece manager.
type PieceManager ¶
type PieceManager interface { // Import imports a file. // // @input - context, file path. // // @output - cid imported, error. Import(ctx context.Context, path string) (cid.Cid, error) // ImportCar imports a car file. // // @input - context, file path. // // @output - cid imported, error. ImportCar(ctx context.Context, path string) (cid.Cid, error) // ImportSector imports an unsealed sector copy. // // @input - context, file path, whether to keep a copy in datastore. // // @output - list of cid imported, error. ImportSector(ctx context.Context, path string, copy bool) ([]cid.Cid, error) // ListImported lists all imported pieces. // // @input - context. // // @output - cid chan out, error chan out. ListImported(ctx context.Context) (<-chan cid.Cid, <-chan error) // Inspect inspects a piece. // // @input - context, cid. // // @output - if exists, path, index (applicable in sector), the size, whether a copy is kept, error. Inspect(ctx context.Context, id cid.Cid) (bool, string, int, uint64, bool, error) // Remove removes a piece. // // @input - context, cid. // // @output - error. Remove(ctx context.Context, id cid.Cid) error // LinkSystem returns the linksystem for retrieval. // // @output - linksystem. LinkSystem() ipld.LinkSystem }
PieceManager is an interface for a piece manager that is capable of importing a file, a car file and an unsealed sector.
type PieceManagerImpl ¶
type PieceManagerImpl struct {
// contains filtered or unexported fields
}
PieceManagerImpl implements the PieceManager interface.
func NewPieceManagerImpl ¶
func NewPieceManagerImpl(ctx context.Context, opts Opts) (*PieceManagerImpl, error)
NewPieceManagerImpl creates a new piece manager.
@input - context, options.
@output - piece manager, error.
func (*PieceManagerImpl) Import ¶
func (mgr *PieceManagerImpl) Import(ctx context.Context, path string) (cid.Cid, error)
Import imports a file.
@input - context, file path.
@output - cid imported, error.
func (*PieceManagerImpl) ImportCar ¶
func (mgr *PieceManagerImpl) ImportCar(ctx context.Context, path string) (cid.Cid, error)
ImportCar imports a car file.
@input - context, file path.
@output - cid imported, error.
func (*PieceManagerImpl) ImportSector ¶
func (mgr *PieceManagerImpl) ImportSector(ctx context.Context, path string, copy bool) ([]cid.Cid, error)
ImportSector imports an unsealed sector copy.
@input - context, file path, whether to keep a copy in datastore.
@output - list of cid imported, error.
func (*PieceManagerImpl) Inspect ¶
func (mgr *PieceManagerImpl) Inspect(ctx context.Context, id cid.Cid) (bool, string, int, uint64, bool, error)
Inspect inspects a piece.
@input - context, cid.
@output - if exists, path, index (applicable in sector), the size, whether a copy is kept, error.
func (*PieceManagerImpl) LinkSystem ¶
func (mgr *PieceManagerImpl) LinkSystem() ipld.LinkSystem
LinkSystem returns the linksystem for retrieval.
@output - linksystem.
func (*PieceManagerImpl) ListImported ¶
func (mgr *PieceManagerImpl) ListImported(ctx context.Context) (<-chan cid.Cid, <-chan error)
ListImported lists all imported pieces.
@input - context.
@output - cid chan out, error chan out.
func (*PieceManagerImpl) Remove ¶
func (mgr *PieceManagerImpl) Remove(ctx context.Context, id cid.Cid) error
Remove removes a piece.
@input - context, cid.
@output - error.
func (*PieceManagerImpl) Shutdown ¶
func (mgr *PieceManagerImpl) Shutdown()
Shutdown safely shuts down the component.