Documentation
¶
Index ¶
- Variables
- type Backend
- type KeyValueStore
- type MockBackend
- type MockKeyValueStore
- func (_m *MockKeyValueStore) Delete(ctx context.Context, key string) error
- func (_m *MockKeyValueStore) Get(key string) ([]byte, error)
- func (_m *MockKeyValueStore) List(re string) (map[string][]byte, error)
- func (_m *MockKeyValueStore) Name() string
- func (_m *MockKeyValueStore) Put(ctx context.Context, key string, value []byte) error
- func (_m *MockKeyValueStore) Save(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type KeyValueStore ¶
type KeyValueStore interface {
// Set adds a new key or modifies an existing key in the key-value store
Put(ctx context.Context, key string, value []byte) error
// Get gets an existing key in the key-value store. Returns ErrKeyNotFound
// if key does not exist the key-value store.
Get(key string) ([]byte, error)
// List lists the key-value pairs whose keys match the regular expression
// passed in.
List(re string) (map[string][]byte, error)
// Delete deletes existing keys from the key-value store. Returns ErrKeyNotFound
// if key does not exist the key-value store.
Delete(ctx context.Context, key string) error
// Save saves the key-value store data to the backend.
Save(ctx context.Context) error
// Name returns the unique identifier/name for the key-value store. This is
// used to determine the path that is passed to the backend operations.
Name() string
}
type MockBackend ¶
type MockBackend struct {
// contains filtered or unexported fields
}
func (*MockBackend) Load ¶
func (m *MockBackend) Load(ctx context.Context, pth string) (io.ReadCloser, error)
type MockKeyValueStore ¶
MockKeyValueStore is an autogenerated mock type for the KeyValueStore type
func (*MockKeyValueStore) Delete ¶
func (_m *MockKeyValueStore) Delete(ctx context.Context, key string) error
Delete provides a mock function with given fields: ctx, key
func (*MockKeyValueStore) Get ¶
func (_m *MockKeyValueStore) Get(key string) ([]byte, error)
Get provides a mock function with given fields: key
func (*MockKeyValueStore) List ¶
func (_m *MockKeyValueStore) List(re string) (map[string][]byte, error)
List provides a mock function with given fields: re
func (*MockKeyValueStore) Name ¶
func (_m *MockKeyValueStore) Name() string
Name provides a mock function with given fields:
func (*MockKeyValueStore) Put ¶
Set provides a mock function with given fields: ctx, key, value
func (*MockKeyValueStore) Save ¶
func (_m *MockKeyValueStore) Save(ctx context.Context) error
Save provides a mock function with given fields: ctx
Source Files
¶
- backend.go
- kvstore.go
- mocks.go
Click to show internal directories.
Click to hide internal directories.