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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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