memory

package
v0.2.2-linux Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltStore

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

BoltStore is an in-memory implementation of the Storage driver. Should not be used for anything other than testing.

func MakeBoltStore

func MakeBoltStore(bucket, path string) *BoltStore

MakeBoltStore returns a new BoltStore for a given path.

func (*BoltStore) DeleteKeys

func (e *BoltStore) DeleteKeys(prefix string) error

DeleteKeys is actually DeleteBucket when in BoltDB It was just introduced for Consul designed tests.

func (*BoltStore) Get

func (e *BoltStore) Get(reader types.ReaderWriter, tree *types.Tree) error

Get gets the latest version of a Key. Refer to GetVersion for more internal details.

func (*BoltStore) GetKey

func (e *BoltStore) GetKey(key string) ([]byte, error)

GetKey returns the value of a Key

func (*BoltStore) GetKeys

func (e *BoltStore) GetKeys(prefix string, separator string) ([]string, error)

GetKeys gets all the keys under a given Prefix

func (*BoltStore) GetVersion

func (e *BoltStore) GetVersion(reader types.ReaderWriter, tree *types.Tree, version string) error

GetVersion gets the specific version of a Key. Raises error if Key is absent.

func (*BoltStore) GetVersions

func (e *BoltStore) GetVersions(reader types.ReaderWriter, tree *types.Tree) ([]string, error)

GetVersions returns an array of all versions that are available for a given key.

func (*BoltStore) Lock

func (e *BoltStore) Lock(key, s string) error

Lock tries to lock a key with a given value. As of now value doesnt matter, existence of zero length value is assumed as Lock.

func (*BoltStore) Save

func (e *BoltStore) Save(source types.ReaderWriter, tree *types.Tree) error

Save is an Internal method to save Any data under a hierarchy that follows revision control. Example: In a workspace staging, you wish to save a new layout called dc1 saveRevision("staging", "layout", "dc1", {....}) will try to save the following structure workspace/layouts/dc1/latest workspace/layouts/dc1/new_timestamp NOTE: This is an atomic operation, so either everything is written or nothing is. The operation may take its own sweet time before a quorum write is guaranteed.

func (*BoltStore) SaveKey

func (e *BoltStore) SaveKey(key string, val []byte) error

func (*BoltStore) Setup

func (e *BoltStore) Setup() error

Setup creates a new Bucket if it doesn't exist already. Ideally it should be deleted after every test.

func (*BoltStore) Teardown

func (e *BoltStore) Teardown() error

Teardown has not been implemented yet.

func (*BoltStore) Unlock

func (e *BoltStore) Unlock(key string) error

Unlock the key previouslu locked. Does not raise error if called multiple times.

Jump to

Keyboard shortcuts

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