data_store

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package data_store provides data store functionality. The data store is kept in memory, but optionally the data store may be saved to a file to provide a perisistent data store. This uses go-cache (https://github.com/pmylund/go-cache) for storing the data.

The methods that set, get, and delete key/value pairs also take a `key_type` argument that specifies what kind of object it is.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WalkMapForNil added in v0.3.0

func WalkMapForNil(r interface{}) interface{}

Walk through the given map, searching for nil slices to create. This does not handle all possible cases, but it *does* handle the cases found with the chef objects in goiardi.

Types

type DataStore

type DataStore struct {
	// contains filtered or unexported fields
}

Main data store.

func New

func New() *DataStore

Create a new data store instance, or return an already created one.

func (*DataStore) Delete

func (ds *DataStore) Delete(key_type string, key string)

func (*DataStore) Get

func (ds *DataStore) Get(key_type string, key string) (interface{}, bool)

func (*DataStore) GetList

func (ds *DataStore) GetList(key_type string) []string

Return a list of all objects of the given type.

func (*DataStore) Load added in v0.3.0

func (ds *DataStore) Load(dsFile string) error

Load the frozen data store from disk.

func (*DataStore) Save added in v0.3.0

func (ds *DataStore) Save(dsFile string) error

Freeze and save the data store to disk.

func (*DataStore) Set

func (ds *DataStore) Set(key_type string, key string, val interface{})

Jump to

Keyboard shortcuts

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