mapstate

package
Version: v0.0.0-...-857e381 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 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.CidArgSerial
	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.CidArg) error

Add adds a CidArg to the internal map.

func (*MapState) Get

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

Get returns CidArg 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.CidArg

List provides the list of tracked CidArgs.

func (*MapState) Rm

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

Rm removes a Cid from the internal map.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL