pinstore

package
v2.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrDuplicatePinCollection is returned when attempted to pin the same file repeatedly
	ErrDuplicatePinCollection = errors.New("pin store: duplicate pin collection")
)

Functions

func CleanupDirty

func CleanupDirty(st transaction.Storage) error

CleanupDirty will iterate over all the dirty collections and delete them.

func DeletePin

func DeletePin(ctx context.Context, st transaction.Storage, root swarm.Address) error

DeletePin will delete the root pin and all the chunks that are part of this collection.

func HasPin

func HasPin(st storage.Reader, root swarm.Address) (bool, error)

HasPin function will check if the address represents a valid pin collection.

func IterateCollection

func IterateCollection(st storage.Reader, root swarm.Address, fn func(addr swarm.Address) (bool, error)) error

func IterateCollectionStats

func IterateCollectionStats(st storage.Reader, iterateFn func(st CollectionStat) (bool, error)) error

func NewCollection

NewCollection returns a putter wrapped around the passed storage. The putter will add the chunk to Chunk store if it doesn't exists within this collection. It will create a new UUID for the collection which can be used to iterate on all the chunks that are part of this collection. The root pin is only updated on successful close of this. Calls to the Putter MUST be mutex locked to prevent concurrent upload data races.

func Pins

func Pins(st storage.Reader) ([]swarm.Address, error)

Pins lists all the added pinning collections.

Types

type CollectionStat

type CollectionStat struct {
	Total           uint64
	DupInCollection uint64
}

CollectionStat is used to store some basic stats about the pinning collection

Jump to

Keyboard shortcuts

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