storage: add comments about errors from MemoryStore

It never returns errors for some operations and this knowledge can be used by
other code.
This commit is contained in:
Roman Khimov 2019-09-26 18:35:36 +03:00
parent 920d7c610c
commit 4a732d97ac

View file

@ -47,7 +47,7 @@ func (s *MemoryStore) Get(key []byte) ([]byte, error) {
return nil, ErrKeyNotFound
}
// Put implements the Store interface.
// Put implements the Store interface. Never returns an error.
func (s *MemoryStore) Put(key, value []byte) error {
s.Lock()
s.mem[makeKey(key)] = value
@ -55,7 +55,7 @@ func (s *MemoryStore) Put(key, value []byte) error {
return nil
}
// PutBatch implements the Store interface.
// PutBatch implements the Store interface. Never returns an error.
func (s *MemoryStore) PutBatch(batch Batch) error {
b := batch.(*MemoryBatch)
for k, v := range b.m {
@ -105,7 +105,8 @@ func (s *MemoryStore) Persist(ps Store) (int, error) {
return keys, err
}
// Close implements Store interface and clears up memory.
// Close implements Store interface and clears up memory. Never returns an
// error.
func (s *MemoryStore) Close() error {
s.Lock()
s.mem = nil