aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage
diff options
context:
space:
mode:
authorMaksim <mchusovlianov@gmail.com>2017-02-09 01:01:12 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-02-09 01:01:12 +0800
commit6dd27e7cff818493356ddecd8918b69fb18b998a (patch)
treef90e05a601acc2b5934e3398e3fdbd38eef3d0d6 /swarm/storage
parentfa99986143fe3dec08cdffcff9185e3700719edd (diff)
downloaddexon-6dd27e7cff818493356ddecd8918b69fb18b998a.tar
dexon-6dd27e7cff818493356ddecd8918b69fb18b998a.tar.gz
dexon-6dd27e7cff818493356ddecd8918b69fb18b998a.tar.bz2
dexon-6dd27e7cff818493356ddecd8918b69fb18b998a.tar.lz
dexon-6dd27e7cff818493356ddecd8918b69fb18b998a.tar.xz
dexon-6dd27e7cff818493356ddecd8918b69fb18b998a.tar.zst
dexon-6dd27e7cff818493356ddecd8918b69fb18b998a.zip
swarm/storage: release chunk storage after stop swarm (#3651)
closes #3650
Diffstat (limited to 'swarm/storage')
-rw-r--r--swarm/storage/dbstore.go2
-rw-r--r--swarm/storage/dbstore_test.go6
-rw-r--r--swarm/storage/dpa.go5
-rw-r--r--swarm/storage/localstore.go5
-rw-r--r--swarm/storage/memstore.go5
-rw-r--r--swarm/storage/netstore.go5
-rw-r--r--swarm/storage/types.go1
7 files changed, 25 insertions, 4 deletions
diff --git a/swarm/storage/dbstore.go b/swarm/storage/dbstore.go
index 4ddebb021..f5d124d29 100644
--- a/swarm/storage/dbstore.go
+++ b/swarm/storage/dbstore.go
@@ -408,7 +408,7 @@ func (s *DbStore) getEntryCnt() uint64 {
return s.entryCnt
}
-func (s *DbStore) close() {
+func (s *DbStore) Close() {
s.db.Close()
}
diff --git a/swarm/storage/dbstore_test.go b/swarm/storage/dbstore_test.go
index 3d2b5bc36..ddce7ccfe 100644
--- a/swarm/storage/dbstore_test.go
+++ b/swarm/storage/dbstore_test.go
@@ -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")),
diff --git a/swarm/storage/dpa.go b/swarm/storage/dpa.go
index 31b6c54ac..7b3e23cac 100644
--- a/swarm/storage/dpa.go
+++ b/swarm/storage/dpa.go
@@ -237,3 +237,8 @@ func (self *dpaChunkStore) Put(entry *Chunk) {
self.n++
self.netStore.Put(chunk)
}
+
+// Close chunk store
+func (self *dpaChunkStore) Close() {
+ return
+}
diff --git a/swarm/storage/localstore.go b/swarm/storage/localstore.go
index 541462f0c..14827e361 100644
--- a/swarm/storage/localstore.go
+++ b/swarm/storage/localstore.go
@@ -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
+}
diff --git a/swarm/storage/memstore.go b/swarm/storage/memstore.go
index f133bd7d3..e55abb45f 100644
--- a/swarm/storage/memstore.go
+++ b/swarm/storage/memstore.go
@@ -314,3 +314,8 @@ func (s *MemStore) removeOldest() {
}
}
}
+
+// Close memstore
+func (s *MemStore) Close() {
+ return
+}
diff --git a/swarm/storage/netstore.go b/swarm/storage/netstore.go
index f97862bbb..46479b58a 100644
--- a/swarm/storage/netstore.go
+++ b/swarm/storage/netstore.go
@@ -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
+}
diff --git a/swarm/storage/types.go b/swarm/storage/types.go
index f3ab99c6c..cc5ded931 100644
--- a/swarm/storage/types.go
+++ b/swarm/storage/types.go
@@ -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()
}
/*