Documentation
¶
Index ¶
- Constants
- Variables
- func NewDirectInmem(conf map[string]string, logger log.Logger) (physical.Backend, error)
- func NewInmem(conf map[string]string, logger log.Logger) (physical.Backend, error)
- func NewInmemHA(_ map[string]string, logger log.Logger) (physical.Backend, error)
- func OpName(op int) string
- type InmemBackend
- func (i *InmemBackend) Delete(ctx context.Context, key string) error
- func (i *InmemBackend) DeleteInternal(ctx context.Context, key string) error
- func (i *InmemBackend) FailDelete(fail bool)
- func (i *InmemBackend) FailGet(fail bool)
- func (i *InmemBackend) FailList(fail bool)
- func (i *InmemBackend) FailPut(fail bool)
- func (i *InmemBackend) Get(ctx context.Context, key string) (*physical.Entry, error)
- func (i *InmemBackend) GetInternal(ctx context.Context, key string) (*physical.Entry, error)
- func (i *InmemBackend) List(ctx context.Context, prefix string) ([]string, error)
- func (i *InmemBackend) ListInternal(ctx context.Context, prefix string) ([]string, error)
- func (i *InmemBackend) ListPage(ctx context.Context, prefix string, after string, limit int) ([]string, error)
- func (i *InmemBackend) ListPaginatedInternal(ctx context.Context, prefix string, after string, limit int) ([]string, error)
- func (i *InmemBackend) Put(ctx context.Context, entry *physical.Entry) error
- func (i *InmemBackend) PutInternal(ctx context.Context, entry *physical.Entry) error
- type InmemBackendTransaction
- func (i *InmemBackendTransaction) Commit(ctx context.Context) error
- func (i *InmemBackendTransaction) Delete(ctx context.Context, key string) error
- func (i *InmemBackendTransaction) Get(ctx context.Context, key string) (*physical.Entry, error)
- func (i *InmemBackendTransaction) List(ctx context.Context, prefix string) ([]string, error)
- func (i *InmemBackendTransaction) ListPage(ctx context.Context, prefix string, after string, limit int) ([]string, error)
- func (i *InmemBackendTransaction) Put(ctx context.Context, entry *physical.Entry) error
- func (i *InmemBackendTransaction) Rollback(ctx context.Context) error
- type InmemHABackend
- type InmemLock
- type InmemOp
- type TransactionalInmemBackend
Constants ¶
const ( PutInMemOp int = 1 << iota DeleteInMemOp ListInMemOp ListPageInMemOp GetInMemOp BeginTxInMemOp BeginReadOnlyTxInMemOp CommitTxInMemOp RollbackTxInMemOp )
listInMemOp isn't required as it is handled by listPageInMemOp
Variables ¶
var ( PutDisabledError = errors.New("put operations disabled in inmem backend") GetDisabledError = errors.New("get operations disabled in inmem backend") DeleteDisabledError = errors.New("delete operations disabled in inmem backend") ListDisabledError = errors.New("list operations disabled in inmem backend") )
Functions ¶
func NewDirectInmem ¶
func NewInmemHA ¶
NewInmemHA constructs a new in-memory HA backend. This is only for testing.
Types ¶
type InmemBackend ¶
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(ctx context.Context, key string) error
Delete is used to permanently delete an entry
func (*InmemBackend) DeleteInternal ¶
func (i *InmemBackend) DeleteInternal(ctx context.Context, key string) error
func (*InmemBackend) FailDelete ¶
func (i *InmemBackend) FailDelete(fail bool)
func (*InmemBackend) FailGet ¶
func (i *InmemBackend) FailGet(fail bool)
func (*InmemBackend) FailList ¶
func (i *InmemBackend) FailList(fail bool)
func (*InmemBackend) FailPut ¶
func (i *InmemBackend) FailPut(fail bool)
func (*InmemBackend) GetInternal ¶
func (*InmemBackend) List ¶
List is used to list all the keys under a given prefix, up to the next prefix.
func (*InmemBackend) ListInternal ¶
func (*InmemBackend) ListPage ¶
func (i *InmemBackend) ListPage(ctx context.Context, prefix string, after string, limit int) ([]string, error)
ListPage is used to list all the keys under a given prefix, up to the next prefix, but limiting to a specified number of keys after a given entry.
func (*InmemBackend) ListPaginatedInternal ¶
func (*InmemBackend) PutInternal ¶
type InmemBackendTransaction ¶
type InmemBackendTransaction struct { InmemBackend // contains filtered or unexported fields }
func (*InmemBackendTransaction) Commit ¶
func (i *InmemBackendTransaction) Commit(ctx context.Context) error
func (*InmemBackendTransaction) Delete ¶
func (i *InmemBackendTransaction) Delete(ctx context.Context, key string) error
type InmemHABackend ¶
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
type InmemLock ¶
type InmemLock struct {
// contains filtered or unexported fields
}
InmemLock is an in-memory Lock implementation for the HABackend
type TransactionalInmemBackend ¶
type TransactionalInmemBackend struct { InmemBackend // contains filtered or unexported fields }
func (*TransactionalInmemBackend) BeginReadOnlyTx ¶
func (i *TransactionalInmemBackend) BeginReadOnlyTx(ctx context.Context) (physical.Transaction, error)
func (*TransactionalInmemBackend) BeginTx ¶
func (i *TransactionalInmemBackend) BeginTx(ctx context.Context) (physical.Transaction, error)