swarm/storage: release chunk storage after stop swarm (#3651)
closes #3650
This commit is contained in:
@ -408,7 +408,7 @@ func (s *DbStore) getEntryCnt() uint64 {
|
||||
return s.entryCnt
|
||||
}
|
||||
|
||||
func (s *DbStore) close() {
|
||||
func (s *DbStore) Close() {
|
||||
s.db.Close()
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ func initDbStore(t *testing.T) *DbStore {
|
||||
|
||||
func testDbStore(l int64, branches int64, t *testing.T) {
|
||||
m := initDbStore(t)
|
||||
defer m.close()
|
||||
defer m.Close()
|
||||
testStore(m, l, branches, t)
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ func TestDbStore2_100_(t *testing.T) {
|
||||
|
||||
func TestDbStoreNotFound(t *testing.T) {
|
||||
m := initDbStore(t)
|
||||
defer m.close()
|
||||
defer m.Close()
|
||||
_, err := m.Get(ZeroKey)
|
||||
if err != notFound {
|
||||
t.Errorf("Expected notFound, got %v", err)
|
||||
@ -73,7 +73,7 @@ func TestDbStoreNotFound(t *testing.T) {
|
||||
|
||||
func TestDbStoreSyncIterator(t *testing.T) {
|
||||
m := initDbStore(t)
|
||||
defer m.close()
|
||||
defer m.Close()
|
||||
keys := []Key{
|
||||
Key(common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000000")),
|
||||
Key(common.Hex2Bytes("4000000000000000000000000000000000000000000000000000000000000000")),
|
||||
|
@ -237,3 +237,8 @@ func (self *dpaChunkStore) Put(entry *Chunk) {
|
||||
self.n++
|
||||
self.netStore.Put(chunk)
|
||||
}
|
||||
|
||||
// Close chunk store
|
||||
func (self *dpaChunkStore) Close() {
|
||||
return
|
||||
}
|
||||
|
@ -72,3 +72,8 @@ func (self *LocalStore) Get(key Key) (chunk *Chunk, err error) {
|
||||
self.memStore.Put(chunk)
|
||||
return
|
||||
}
|
||||
|
||||
// Close local store
|
||||
func (self *LocalStore) Close() {
|
||||
return
|
||||
}
|
||||
|
@ -314,3 +314,8 @@ func (s *MemStore) removeOldest() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close memstore
|
||||
func (s *MemStore) Close() {
|
||||
return
|
||||
}
|
||||
|
@ -132,3 +132,8 @@ func (self *NetStore) Get(key Key) (*Chunk, error) {
|
||||
go self.cloud.Retrieve(chunk)
|
||||
return chunk, nil
|
||||
}
|
||||
|
||||
// Close netstore
|
||||
func (self *NetStore) Close() {
|
||||
return
|
||||
}
|
||||
|
@ -167,6 +167,7 @@ The ChunkStore interface is implemented by :
|
||||
type ChunkStore interface {
|
||||
Put(*Chunk) // effectively there is no error even if there is an error
|
||||
Get(Key) (*Chunk, error)
|
||||
Close()
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user