Documentation ¶
Index ¶
- Variables
- func NewInmem(conf map[string]string, logger log.Logger) (physical.Backend, error)
- func NewInmemHA(_ map[string]string, logger log.Logger) (physical.Backend, error)
- func NewTransactionalInmem(conf map[string]string, logger log.Logger) (physical.Backend, error)
- func NewTransactionalInmemHA(_ map[string]string, logger log.Logger) (physical.Backend, error)
- 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) FailGetInTxn(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) GetMountTablePaths() []string
- 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) Put(ctx context.Context, entry *physical.Entry) error
- func (i *InmemBackend) PutInternal(ctx context.Context, entry *physical.Entry) error
- func (i *InmemBackend) RegisterMountTablePath(path string)
- func (i *InmemBackend) SetWriteLatency(latency time.Duration)
- type InmemHABackend
- type InmemLock
- type TransactionalInmemBackend
- func (t *TransactionalInmemBackend) BatchStats() (maxEntries uint64, maxSize uint64)
- func (t *TransactionalInmemBackend) SetMaxBatchEntries(entries int)
- func (t *TransactionalInmemBackend) SetMaxBatchSize(entries int)
- func (t *TransactionalInmemBackend) Transaction(ctx context.Context, txns []*physical.TxnEntry) error
- func (t *TransactionalInmemBackend) TransactionLimits() (int, int)
- func (t *TransactionalInmemBackend) TxnCommitChan() <-chan *txnCommitRequest
- type TransactionalInmemHABackend
Constants ¶
This section is empty.
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") GetInTxnDisabledError = errors.New("get operations inside transactions are disabled in inmem backend") )
Functions ¶
func NewInmemHA ¶
NewInmemHA constructs a new in-memory HA backend. This is only for testing.
func NewTransactionalInmem ¶
Basically for now just creates a permit pool of size 1 so only one operation can run at a time
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) FailGetInTxn ¶ added in v0.6.0
func (i *InmemBackend) FailGetInTxn(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) GetMountTablePaths ¶ added in v0.12.0
func (i *InmemBackend) GetMountTablePaths() []string
GetMountTablePaths returns any paths registered as mount table or namespace metadata paths. It's intended for testing.
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) PutInternal ¶
func (*InmemBackend) RegisterMountTablePath ¶ added in v0.12.0
func (i *InmemBackend) RegisterMountTablePath(path string)
RegisterMountTablePath implements physical.MountTableLimitingBackend
func (*InmemBackend) SetWriteLatency ¶ added in v0.11.0
func (i *InmemBackend) SetWriteLatency(latency time.Duration)
SetWriteLatency add a sleep to each Put/Delete operation (and each op in a transaction for a TransactionalInmemBackend). It's not so much to simulate real disk latency as much as to make the go runtime schedule things more like a real disk where concurrent write operations are more likely to interleave as each one blocks on disk IO. Set to 0 to disable again (the default).
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) BatchStats ¶ added in v0.11.0
func (t *TransactionalInmemBackend) BatchStats() (maxEntries uint64, maxSize uint64)
func (*TransactionalInmemBackend) SetMaxBatchEntries ¶ added in v0.11.0
func (t *TransactionalInmemBackend) SetMaxBatchEntries(entries int)
func (*TransactionalInmemBackend) SetMaxBatchSize ¶ added in v0.11.0
func (t *TransactionalInmemBackend) SetMaxBatchSize(entries int)
func (*TransactionalInmemBackend) Transaction ¶
func (t *TransactionalInmemBackend) Transaction(ctx context.Context, txns []*physical.TxnEntry) error
Transaction implements the transaction interface
func (*TransactionalInmemBackend) TransactionLimits ¶ added in v0.11.0
func (t *TransactionalInmemBackend) TransactionLimits() (int, int)
func (*TransactionalInmemBackend) TxnCommitChan ¶ added in v0.13.0
func (t *TransactionalInmemBackend) TxnCommitChan() <-chan *txnCommitRequest
TxnCommitChan returns a channel that allows deterministic control of when transactions are executed. Each time `Transaction` is called on the backend, a txnCommitRequest is sent on the chan returned and then Transaction will block until Done is called on that request object. This allows tests to deterministically wait until a persist is actually in progress, as well as control when the persist completes. The returned chan is buffered with a length of 5 which should be enough to ensure that test code doesn't deadlock in normal operation since we typically only have one outstanding transaction at at time.
type TransactionalInmemHABackend ¶
type TransactionalInmemHABackend struct { physical.Transactional InmemHABackend }