Documentation
¶
Overview ¶
Package database is a generated GoMock package.
Package database is a generated GoMock package.
Index ¶
- type Compacter
- type Database
- type KeyValueDeleter
- type KeyValueReader
- type KeyValueReaderWriter
- type KeyValueReaderWriterDeleter
- type KeyValueWriter
- type KeyValueWriterDeleter
- type MockBatch
- func (m *MockBatch) Delete(arg0 []byte) error
- func (m *MockBatch) EXPECT() *MockBatchMockRecorder
- func (m *MockBatch) Inner() database.Batch
- func (m *MockBatch) Put(arg0, arg1 []byte) error
- func (m *MockBatch) Replay(arg0 KeyValueWriterDeleter) error
- func (m *MockBatch) Reset()
- func (m *MockBatch) Size() int
- func (m *MockBatch) Write() error
- type MockBatchMockRecorder
- func (mr *MockBatchMockRecorder) Delete(arg0 any) *gomock.Call
- func (mr *MockBatchMockRecorder) Inner() *gomock.Call
- func (mr *MockBatchMockRecorder) Put(arg0, arg1 any) *gomock.Call
- func (mr *MockBatchMockRecorder) Replay(arg0 any) *gomock.Call
- func (mr *MockBatchMockRecorder) Reset() *gomock.Call
- func (mr *MockBatchMockRecorder) Size() *gomock.Call
- func (mr *MockBatchMockRecorder) Write() *gomock.Call
- type MockIterator
- type MockIteratorMockRecorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compacter ¶
type Compacter interface {
// Compact the underlying DB for the given key range.
// Specifically, deleted and overwritten versions are discarded,
// and the data is rearranged to reduce the cost of operations
// needed to access the data. This operation should typically only
// be invoked by users who understand the underlying implementation.
//
// A nil start is treated as a key before all keys in the DB.
// And a nil limit is treated as a key after all keys in the DB.
// Therefore if both are nil then it will compact entire DB.
//
// Note: [start] and [limit] are safe to modify and read after calling Compact.
Compact(start []byte, limit []byte) error
}
Compacter wraps the Compact method of a backing data store.
type Database ¶
type Database interface {
KeyValueReaderWriterDeleter
database.Batcher
database.Iteratee
Compacter
io.Closer
health.Checker
}
Database contains all the methods required to allow handling different key-value data stores backing the database.
type KeyValueDeleter ¶ added in v0.1.1
type KeyValueDeleter interface {
// Delete removes the key from the key-value data store.
//
// Note: [key] is safe to modify and read after calling Delete.
Delete(key []byte) error
}
KeyValueDeleter wraps the Delete method of a backing data store.
type KeyValueReader ¶
type KeyValueReader interface {
// Has retrieves if a key is present in the key-value data store.
//
// Note: [key] is safe to modify and read after calling Has.
Has(key []byte) (bool, error)
// Get retrieves the given key if it's present in the key-value data store.
// Returns ErrNotFound if the key is not present in the key-value data store.
//
// Note: [key] is safe to modify and read after calling Get.
// The returned byte slice is safe to read, but cannot be modified.
Get(key []byte) ([]byte, error)
}
KeyValueReader wraps the Has and Get method of a backing data store.
type KeyValueReaderWriter ¶ added in v0.1.1
type KeyValueReaderWriter interface {
KeyValueReader
KeyValueWriter
}
KeyValueReaderWriter allows read/write acccess to a backing data store.
type KeyValueReaderWriterDeleter ¶ added in v0.1.1
type KeyValueReaderWriterDeleter interface {
KeyValueReader
KeyValueWriter
KeyValueDeleter
}
KeyValueReaderWriterDeleter allows read/write/delete access to a backing data store.
type KeyValueWriter ¶
type KeyValueWriter interface {
// Put inserts the given value into the key-value data store.
//
// Note: [key] and [value] are safe to modify and read after calling Put.
//
// If [value] is nil or an empty slice, then when it's retrieved
// it may be nil or an empty slice.
//
// Similarly, a nil [key] is treated the same as an empty slice.
Put(key []byte, value []byte) error
}
KeyValueWriter wraps the Put method of a backing data store.
type KeyValueWriterDeleter ¶ added in v0.1.1
type KeyValueWriterDeleter interface {
KeyValueWriter
KeyValueDeleter
}
KeyValueWriterDeleter allows write/delete acccess to a backing data store.
type MockBatch ¶ added in v1.11.10
type MockBatch struct {
// contains filtered or unexported fields
}
MockBatch is a mock of Batch interface.
func NewMockBatch ¶ added in v1.11.10
func NewMockBatch(ctrl *gomock.Controller) *MockBatch
NewMockBatch creates a new mock instance.
func (*MockBatch) EXPECT ¶ added in v1.11.10
func (m *MockBatch) EXPECT() *MockBatchMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBatch) Replay ¶ added in v1.11.10
func (m *MockBatch) Replay(arg0 KeyValueWriterDeleter) error
Replay mocks base method.
type MockBatchMockRecorder ¶ added in v1.11.10
type MockBatchMockRecorder struct {
// contains filtered or unexported fields
}
MockBatchMockRecorder is the mock recorder for MockBatch.
func (*MockBatchMockRecorder) Delete ¶ added in v1.11.10
func (mr *MockBatchMockRecorder) Delete(arg0 any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockBatchMockRecorder) Inner ¶ added in v1.11.10
func (mr *MockBatchMockRecorder) Inner() *gomock.Call
Inner indicates an expected call of Inner.
func (*MockBatchMockRecorder) Put ¶ added in v1.11.10
func (mr *MockBatchMockRecorder) Put(arg0, arg1 any) *gomock.Call
Put indicates an expected call of Put.
func (*MockBatchMockRecorder) Replay ¶ added in v1.11.10
func (mr *MockBatchMockRecorder) Replay(arg0 any) *gomock.Call
Replay indicates an expected call of Replay.
func (*MockBatchMockRecorder) Reset ¶ added in v1.11.10
func (mr *MockBatchMockRecorder) Reset() *gomock.Call
Reset indicates an expected call of Reset.
func (*MockBatchMockRecorder) Size ¶ added in v1.11.10
func (mr *MockBatchMockRecorder) Size() *gomock.Call
Size indicates an expected call of Size.
func (*MockBatchMockRecorder) Write ¶ added in v1.11.10
func (mr *MockBatchMockRecorder) Write() *gomock.Call
Write indicates an expected call of Write.
type MockIterator ¶ added in v1.11.10
type MockIterator struct {
// contains filtered or unexported fields
}
MockIterator is a mock of Iterator interface.
func NewMockIterator ¶ added in v1.11.10
func NewMockIterator(ctrl *gomock.Controller) *MockIterator
NewMockIterator creates a new mock instance.
func (*MockIterator) EXPECT ¶ added in v1.11.10
func (m *MockIterator) EXPECT() *MockIteratorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockIterator) Error ¶ added in v1.11.10
func (m *MockIterator) Error() error
Error mocks base method.
func (*MockIterator) Key ¶ added in v1.11.10
func (m *MockIterator) Key() []byte
Key mocks base method.
func (*MockIterator) Next ¶ added in v1.11.10
func (m *MockIterator) Next() bool
Next mocks base method.
func (*MockIterator) Release ¶ added in v1.11.10
func (m *MockIterator) Release()
Release mocks base method.
func (*MockIterator) Value ¶ added in v1.11.10
func (m *MockIterator) Value() []byte
Value mocks base method.
type MockIteratorMockRecorder ¶ added in v1.11.10
type MockIteratorMockRecorder struct {
// contains filtered or unexported fields
}
MockIteratorMockRecorder is the mock recorder for MockIterator.
func (*MockIteratorMockRecorder) Error ¶ added in v1.11.10
func (mr *MockIteratorMockRecorder) Error() *gomock.Call
Error indicates an expected call of Error.
func (*MockIteratorMockRecorder) Key ¶ added in v1.11.10
func (mr *MockIteratorMockRecorder) Key() *gomock.Call
Key indicates an expected call of Key.
func (*MockIteratorMockRecorder) Next ¶ added in v1.11.10
func (mr *MockIteratorMockRecorder) Next() *gomock.Call
Next indicates an expected call of Next.
func (*MockIteratorMockRecorder) Release ¶ added in v1.11.10
func (mr *MockIteratorMockRecorder) Release() *gomock.Call
Release indicates an expected call of Release.
func (*MockIteratorMockRecorder) Value ¶ added in v1.11.10
func (mr *MockIteratorMockRecorder) Value() *gomock.Call
Value indicates an expected call of Value.