storage

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilStorage = errors.New("container storage is nil")

ErrNilStorage is the error returned by functions that expect a non-nil container storage implementation, but received nil.

View Source
var ErrNotFound = errors.New("container not found")

ErrNotFound is the error returned when container was not found in storage.

Functions

This section is empty.

Types

type CID

type CID = container.ID

CID represents the container identifier.

It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/container.ID.

type Container

type Container = container.Container

Container represents the NeoFS container.

It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/container.Container.

type OwnerID

type OwnerID = container.OwnerID

OwnerID represents the container owner identifier.

It is a type alias of github.com/nspcc-dev/neofs-node/pkg/core/container.OwnerID.

type Storage

type Storage interface {
	// Put saves pointed container to the underlying storage.
	// It returns calculated container identifier and any error
	// encountered that caused the saving to interrupt.
	//
	// Put must return container.ErrNilContainer on nil-pointer.
	//
	// Implementations must not modify the container through the pointer (even temporarily).
	// Implementations must not retain the container pointer.
	//
	// Container rewriting behavior is dictated by implementation.
	Put(*Container) (*CID, error)

	// Get reads the container from the storage by identifier.
	// It returns the pointer to requested container and any error encountered.
	//
	// Get must return exactly one non-nil value.
	// Get must return ErrNotFound if the container is not in storage.
	//
	// Implementations must not retain the container pointer and modify
	// the container through it.
	Get(CID) (*Container, error)

	// Delete removes the container from the storage.
	// It returns any error encountered that caused the deletion to interrupt.
	//
	// Delete must return nil if container was successfully deleted.
	//
	// Behavior when deleting a nonexistent container is dictated by implementation.
	Delete(CID) error

	// List returns a list of container identifiers belonging to the specified owner.
	// It returns any error encountered that caused the listing to interrupt.
	//
	// List must return the identifiers of all stored containers if owner pointer is nil.
	// List must return the empty list and no error in the absence of containers in storage.
	//
	// Result slice can be either empty slice or nil, so empty list should be checked
	// by comparing with zero length (not nil).
	//
	// Callers should carefully handle the incomplete list in case of interrupt error.
	List(*OwnerID) ([]CID, error)
}

Storage is an interface that wraps basic container storage methods.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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