state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is exported
	ErrNotFound = errors.New("not found")
	// ErrAlreadyExists is exported
	ErrAlreadyExists = errors.New("already exists")
	// ErrInvalidKey is exported
	ErrInvalidKey = errors.New("invalid key")
)

Functions

This section is empty.

Types

type RequestedState

type RequestedState struct {
	ID     string
	Name   string
	Config *dockerclient.ContainerConfig
}

RequestedState is exported

type Store

type Store struct {
	RootDir string

	sync.RWMutex
	// contains filtered or unexported fields
}

Store is a simple key<->RequestedState store.

func NewStore

func NewStore(rootdir string) *Store

NewStore is exported

func (*Store) Add

func (s *Store) Add(key string, value *RequestedState) error

Add a new object on the store. `key` must be unique.

func (*Store) All

func (s *Store) All() []*RequestedState

All objects of the store are returned.

func (*Store) Get

func (s *Store) Get(key string) (*RequestedState, error)

Get an object from the store keyed by `key`.

func (*Store) Initialize

func (s *Store) Initialize() error

Initialize must be called before performing any operation on the store. It will attempt to restore the data from disk.

func (*Store) Remove

func (s *Store) Remove(key string) error

Remove `key` from the store.

func (*Store) Replace

func (s *Store) Replace(key string, value *RequestedState) error

Replace an already existing object from the store.

Jump to

Keyboard shortcuts

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