pinning

package
v1.8.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package pinning provides a simple set of operations for tracking pinned references.

Index

Constants

This section is empty.

Variables

View Source
var ErrTraversal = errors.New("traversal iteration failed")

ErrTraversal signals that errors occurred during nodes traversal.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// CreatePin creates a new pin for the given reference.
	// The boolean arguments specifies whether all nodes
	// in the tree should also be traversed and pinned.
	// Repeating calls of this method are idempotent.
	CreatePin(context.Context, swarm.Address, bool) error
	// DeletePin deletes given reference. All the existing
	// nodes in the tree will also be traversed and un-pinned.
	// Repeating calls of this method are idempotent.
	DeletePin(context.Context, swarm.Address) error
	// HasPin returns true if the given reference has root pin.
	HasPin(swarm.Address) (bool, error)
	// Pins return all pinned references.
	Pins() ([]swarm.Address, error)
}

Interface defines pinning operations.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is implementation of the pinning.Interface.

func NewService

func NewService(
	pinStorage storage.Storer,
	rhStorage storage.StateStorer,
	traverser traversal.Traverser,
) *Service

NewService is a convenient constructor for Service.

func (*Service) CreatePin

func (s *Service) CreatePin(ctx context.Context, ref swarm.Address, traverse bool) error

CreatePin implements Interface.CreatePin method.

func (*Service) DeletePin

func (s *Service) DeletePin(ctx context.Context, ref swarm.Address) error

DeletePin implements Interface.DeletePin method.

func (*Service) HasPin

func (s *Service) HasPin(ref swarm.Address) (bool, error)

HasPin implements Interface.HasPin method.

func (*Service) Pins

func (s *Service) Pins() ([]swarm.Address, error)

Pins implements Interface.Pins method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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