Documentation
¶
Index ¶
- type AppendableStorage
- type MapStorage
- func (ms *MapStorage) Append(ctx context.Context, key string, value []byte) error
- func (ms *MapStorage) Close(ctx context.Context) error
- func (ms *MapStorage) Get(ctx context.Context, key []byte) ([]byte, error)
- func (ms *MapStorage) GetData() map[string][]byte
- func (ms *MapStorage) Put(ctx context.Context, key []byte, value []byte) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppendableStorage ¶
type AppendableStorage interface { Storage Append(ctx context.Context, key string, data []byte) error }
AppendableStorage is an interface for special storage systems that allow data to be atomically appended to a value.
type MapStorage ¶
type MapStorage struct {
// contains filtered or unexported fields
}
MapStorage is a toy storage system. All data is stored in memory via a single golang map that is trivially synchronized.
func (*MapStorage) GetData ¶
func (ms *MapStorage) GetData() map[string][]byte
GetData is useful for debugging
type Storage ¶
type Storage interface { // Get returns the value associated with a certain key. Get(ctx context.Context, key []byte) ([]byte, error) // Put maps a key to a value, creating a new mapping if the key is not // already mapped. Put(ctx context.Context, key []byte, value []byte) error // Closes the database. Close(ctx context.Context) error }
Storage is an interface for an internally synchronized key-value storage system that a server can use to store data.
Click to show internal directories.
Click to hide internal directories.