mapstate

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Version = 1

Version is the map state Version. States with old versions should perform an upgrade before.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapState

type MapState struct {
	PinMap  map[string]api.PinSerial
	Version int
	// contains filtered or unexported fields
}

MapState is a very simple database to store the state of the system using a Go map. It is thread safe. It implements the State interface.

func NewMapState

func NewMapState() *MapState

NewMapState initializes the internal map and returns a new MapState object.

func (*MapState) Add

func (st *MapState) Add(c api.Pin) error

Add adds a Pin to the internal map.

func (*MapState) Get

func (st *MapState) Get(c *cid.Cid) api.Pin

Get returns Pin information for a CID.

func (*MapState) Has

func (st *MapState) Has(c *cid.Cid) bool

Has returns true if the Cid belongs to the State.

func (*MapState) List

func (st *MapState) List() []api.Pin

List provides the list of tracked Pins.

func (*MapState) Rm

func (st *MapState) Rm(c *cid.Cid) error

Rm removes a Cid from the internal map.

Jump to

Keyboard shortcuts

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