state

package
v0.10.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package state holds the interface that any state implementation for IPFS Cluster must satisfy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State interface {
	// Add adds a pin to the State
	Add(context.Context, *api.Pin) error
	// Rm removes a pin from the State
	Rm(context.Context, cid.Cid) error
	// List lists all the pins in the state
	List(context.Context) []*api.Pin
	// Has returns true if the state is holding information for a Cid
	Has(context.Context, cid.Cid) bool
	// Get returns the information attacthed to this pin
	Get(context.Context, cid.Cid) (*api.Pin, bool)
	// Migrate restores the serialized format of an outdated state to the current version
	Migrate(ctx context.Context, r io.Reader) error
	// Return the version of this state
	GetVersion() int
	// Marshal serializes the state to a byte slice
	Marshal(io.Writer) error
	// Unmarshal deserializes the state from marshaled bytes
	Unmarshal(io.Reader) error
}

State is used by the Consensus component to keep track of objects which objects are pinned. This component should be thread safe.

Directories

Path Synopsis
Package dsstate implements the IPFS Cluster state interface using an underlying go-datastore.
Package dsstate implements the IPFS Cluster state interface using an underlying go-datastore.
Package mapstate implements the State interface for IPFS Cluster by using a map to keep track of the consensus-shared state.
Package mapstate implements the State interface for IPFS Cluster by using a map to keep track of the consensus-shared state.

Jump to

Keyboard shortcuts

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