Documentation ¶
Overview ¶
Package memstore implements the blob.Store and blob.KV interfaces using in-memory dictionaries. This is primarily useful for testing, as the contents are not persisted.
Index ¶
- func Opener(_ context.Context, _ string) (blob.StoreCloser, error)
- type KV
- func (s *KV) Clear()
- func (s *KV) Delete(_ context.Context, key string) error
- func (s *KV) Get(_ context.Context, key string) ([]byte, error)
- func (s *KV) Init(m map[string]string) *KV
- func (s *KV) Len(context.Context) (int64, error)
- func (s *KV) List(_ context.Context, start string, f func(string) error) error
- func (s *KV) Put(_ context.Context, opts blob.PutOptions) error
- func (s *KV) Size(_ context.Context, key string) (int64, error)
- func (s *KV) Snapshot(m map[string]string) map[string]string
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Opener ¶
Opener constructs a blob.StoreCloser for use with the store package. The concrete type of the result is memstore.Store. The address is ignored, and an error is never returned.
Types ¶
type KV ¶ added in v0.7.0
type KV struct {
// contains filtered or unexported fields
}
KV implements the blob.KV interface using an in-memory dictionary. The contents of a Store are not persisted. All operations on a memstore are safe for concurrent use by multiple goroutines.
func (*KV) Init ¶ added in v0.7.0
Init replaces the contents of s with the keys and values in m. It returns s to permit chaining with construction.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
A Store implements the blob.Store interface using an in-memory dictionary for each keyspace. A zero value is ready for use, but must not be copied after its first use.
func New ¶
New constructs a new empty Store that uses newKV to construct keyspaces. If newKV == nil, NewKV is used.
func (*Store) CAS ¶ added in v0.9.0
CAS implements part of blob.Store. This implementation never reports an error.
func (*Store) Close ¶
Close implements part of blob.StoreCloser. This implementation is a no-op.
func (*Store) KV ¶ added in v0.9.0
KV implements part of blob.Store. This implementation never reports an error.