Documentation ¶
Overview ¶
Package state holds the interface that any state implementation for IPFS Cluster must satisfy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("pin is not part of the pinset")
ErrNotFound should be returned when a pin is not part of the state.
Functions ¶
This section is empty.
Types ¶
type BatchingState ¶
type BatchingState interface { State // Commit writes any batched operations. Commit(context.Context) error }
BatchingState represents a state which batches write operations.
type ReadOnly ¶
type ReadOnly interface { // List lists all the pins in the state. List(context.Context, chan<- api.Pin) error // Has returns true if the state is holding information for a Cid. Has(context.Context, api.Cid) (bool, error) // Get returns the information attacthed to this pin, if any. If the // pin is not part of the state, it should return ErrNotFound. Get(context.Context, api.Cid) (api.Pin, error) }
ReadOnly represents the read side of a State.
type State ¶
type State interface { ReadOnly WriteOnly // Migrate restores the serialized format of an outdated state to the // current version. Migrate(ctx context.Context, r io.Reader) error // 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 a wrapper to the Cluster shared state so that Pin objects can be easily read, written and queried. The state can be marshaled and unmarshaled. Implementation should be thread-safe.
Click to show internal directories.
Click to hide internal directories.