blockstoreutil

package
Version: v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2022 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 7 Imported by: 0

Documentation

Overview

Package blockstoreutil provides utility functions for Blockstores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterPinned

func FilterPinned(ctx context.Context, pins pin.Pinner, out chan<- interface{}, cids []cid.Cid) []cid.Cid

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 RmBlocks

func RmBlocks(ctx context.Context, 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

type RemovedBlock struct {
	Hash  string
	Error error
}

RemovedBlock is used to represent the result of removing a block. If a block was removed successfully, then the Error will be empty. If a block could not be removed, then Error will contain the reason the block could not be removed. If the removal was aborted due to a fatal error, Hash will be empty, Error will contain the reason, and no more results will be sent.

type RmBlocksOpts

type RmBlocksOpts struct {
	Prefix string
	Quiet  bool
	Force  bool
}

RmBlocksOpts is used to wrap options for RmBlocks().

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL