pinstore

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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