Documentation ¶
Overview ¶
Package blockstoreutil provides utility functions for Blockstores.
Index ¶
- func FilterPinned(pins pin.Pinner, out chan<- interface{}, cids []*cid.Cid) []*cid.Cid
- func ProcRmOutput(next func() (interface{}, error), sout io.Writer, serr io.Writer) error
- func RmBlocks(blocks bs.GCBlockstore, pins pin.Pinner, cids []*cid.Cid, opts RmBlocksOpts) (<-chan interface{}, error)
- type RemovedBlock
- type RmBlocksOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterPinned ¶
FilterPinned takes a slice of Cids and returns it with the pinned Cids removed. If a Cid is pinned, it will place RemovedBlock objects in the given out channel, with an error which indicates that the Cid is pinned. This function is used in RmBlocks to filter out any blocks which are not to be removed (because they are pinned).
func ProcRmOutput ¶
ProcRmOutput takes a function which returns a result from RmBlocks or EOF if there is no input. It then writes to stdout/stderr according to the RemovedBlock object returned from the function.
func RmBlocks ¶
func RmBlocks(blocks bs.GCBlockstore, pins pin.Pinner, cids []*cid.Cid, opts RmBlocksOpts) (<-chan interface{}, error)
RmBlocks removes the blocks provided in the cids slice. It returns a channel where objects of type RemovedBlock are placed, when not using the Quiet option. Block removal is asynchronous and will skip any pinned blocks.
Types ¶
type RemovedBlock ¶
RemovedBlock is used to respresent the result of removing a block. If a block was removed successfully than the Error string will be empty. If a block could not be removed than Error will contain the reason the block could not be removed. If the removal was aborted due to a fatal error Hash will be be empty, Error will contain the reason, and no more results will be sent.
type RmBlocksOpts ¶
RmBlocksOpts is used to wrap options for RmBlocks().