Package gc provides garbage collection for go-ipfs.
- func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, ...) (*cid.Set, error)
- func Descendants(ctx context.Context, getLinks dag.GetLinks, set *cid.Set, roots cid.Cid) error
- func GC(ctx context.Context, bs bstore.GCBlockstore, dstor dstore.Datastore, ...) <-chan Result
- type CannotDeleteBlockError
- type CannotFetchLinksError
- type Result
This section is empty.
ErrCannotDeleteSomeBlocks is returned when removing blocks marked for deletion fails as the last Result in GC output channel.
ErrCannotFetchAllLinks is returned as the last Result in the GC output channel when there was a error creating the marked set because of a problem when finding descendants.
func ColoredSet ¶
ColoredSet computes the set of nodes in the graph that are pinned by the pins in the given pinner.
func Descendants ¶
Descendants recursively finds all the descendants of the given roots and adds them to the given cid.Set, using the provided dag.GetLinks function to walk the tree.
GC performs a mark and sweep garbage collection of the blocks in the blockstore first, it creates a 'marked' set and adds to it the following: - all recursively pinned blocks, plus all of their descendants (recursively) - bestEffortRoots, plus all of its descendants (recursively) - all directly pinned blocks - all blocks utilized internally by the pinner
The routine then iterates over every block in the blockstore and deletes any block that is not found in the marked set.
type CannotDeleteBlockError ¶
CannotDeleteBlockError provides detailed information about which blocks could not be deleted and can appear as a Result in the GC output channel.
type CannotFetchLinksError ¶
CannotFetchLinksError provides detailed information about which links could not be fetched and can appear as a Result in the GC output channel.