state

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type RequestedState

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

type Store

type Store struct {
	RootDir string

	sync.RWMutex
	// contains filtered or unexported fields
}

A simple key<->RequestedState store.

func NewStore

func NewStore(rootdir string) *Store

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

Return all objects of the store.

func (*Store) Get

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

Retrieves 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

Replaces 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