inmem

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2017 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInmem

func NewInmem(_ map[string]string, logger log.Logger) (physical.Backend, error)

NewInmem constructs a new in-memory backend

func NewInmemHA

func NewInmemHA(_ map[string]string, logger log.Logger) (physical.Backend, error)

NewInmemHA constructs a new in-memory HA backend. This is only for testing.

func NewTransactionalInmem

func NewTransactionalInmem(_ map[string]string, logger log.Logger) (physical.Backend, error)

Basically for now just creates a permit pool of size 1 so only one operation can run at a time

func NewTransactionalInmemHA

func NewTransactionalInmemHA(_ map[string]string, logger log.Logger) (physical.Backend, error)

Types

type InmemBackend

type InmemBackend struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

InmemBackend is an in-memory only physical backend. It is useful for testing and development situations where the data is not expected to be durable.

func (*InmemBackend) Delete

func (i *InmemBackend) Delete(key string) error

Delete is used to permanently delete an entry

func (*InmemBackend) DeleteInternal

func (i *InmemBackend) DeleteInternal(key string) error

func (*InmemBackend) Get

func (i *InmemBackend) Get(key string) (*physical.Entry, error)

Get is used to fetch an entry

func (*InmemBackend) GetInternal

func (i *InmemBackend) GetInternal(key string) (*physical.Entry, error)

func (*InmemBackend) List

func (i *InmemBackend) List(prefix string) ([]string, error)

List is used ot list all the keys under a given prefix, up to the next prefix.

func (*InmemBackend) ListInternal

func (i *InmemBackend) ListInternal(prefix string) ([]string, error)

func (*InmemBackend) Put

func (i *InmemBackend) Put(entry *physical.Entry) error

Put is used to insert or update an entry

func (*InmemBackend) PutInternal

func (i *InmemBackend) PutInternal(entry *physical.Entry) error

type InmemHABackend

type InmemHABackend struct {
	physical.Backend
	// contains filtered or unexported fields
}

func (*InmemHABackend) HAEnabled

func (i *InmemHABackend) HAEnabled() bool

HAEnabled indicates whether the HA functionality should be exposed. Currently always returns true.

func (*InmemHABackend) LockMapSize

func (i *InmemHABackend) LockMapSize() int

LockMapSize is used in some tests to determine whether this backend has ever been used for HA purposes rather than simply for storage

func (*InmemHABackend) LockWith

func (i *InmemHABackend) LockWith(key, value string) (physical.Lock, error)

LockWith is used for mutual exclusion based on the given key.

type InmemLock

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

InmemLock is an in-memory Lock implementation for the HABackend

func (*InmemLock) Lock

func (i *InmemLock) Lock(stopCh <-chan struct{}) (<-chan struct{}, error)

func (*InmemLock) Unlock

func (i *InmemLock) Unlock() error

func (*InmemLock) Value

func (i *InmemLock) Value() (bool, string, error)

type TransactionalInmemBackend

type TransactionalInmemBackend struct {
	InmemBackend
}

func (*TransactionalInmemBackend) Transaction

func (t *TransactionalInmemBackend) Transaction(txns []physical.TxnEntry) error

Implements the transaction interface

type TransactionalInmemHABackend

type TransactionalInmemHABackend struct {
	physical.Transactional
	InmemHABackend
}

Jump to

Keyboard shortcuts

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