pins

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

ErrTraversal signals that errors occurred during nodes traverser.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// CreatePin creates a new pins 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, cluster.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, cluster.Address) error
	// HasPin returns true if the given reference has root pins.
	HasPin(cluster.Address) (bool, error)
	// Pins return all pinned references.
	Pins() ([]cluster.Address, error)
}

Interface defines pins operations.

type Service

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

Service is implementation of the pins.Interface.

func NewService

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

NewService is a convenient constructor for Service.

func (*Service) CreatePin

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

CreatePin implements Interface.CreatePin method.

func (*Service) DeletePin

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

DeletePin implements Interface.DeletePin method.

func (*Service) HasPin

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

HasPin implements Interface.HasPin method.

func (*Service) Pins

func (s *Service) Pins() ([]cluster.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