From bca85efff9a0640ceb8714a5f15cb44dea0c51df Mon Sep 17 00:00:00 2001 From: Janos Guljas Date: Wed, 19 Dec 2018 14:24:14 +0100 Subject: [PATCH] swarm/storage/localstore: unexport modeSetRemove --- swarm/storage/localstore/index_test.go | 2 +- swarm/storage/localstore/mode_set.go | 7 ++++--- swarm/storage/localstore/mode_set_test.go | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/swarm/storage/localstore/index_test.go b/swarm/storage/localstore/index_test.go index 67c858c8f6..d9abf440f1 100644 --- a/swarm/storage/localstore/index_test.go +++ b/swarm/storage/localstore/index_test.go @@ -212,7 +212,7 @@ func TestDB_gcIndex(t *testing.T) { t.Run("remove one chunk", func(t *testing.T) { i := 3 - err := db.NewSetter(ModeSetRemove).Set(chunks[i].Address()) + err := db.NewSetter(modeSetRemove).Set(chunks[i].Address()) if err != nil { t.Fatal(err) } diff --git a/swarm/storage/localstore/mode_set.go b/swarm/storage/localstore/mode_set.go index 9d0cdb19b2..80c7fd3892 100644 --- a/swarm/storage/localstore/mode_set.go +++ b/swarm/storage/localstore/mode_set.go @@ -30,8 +30,9 @@ const ( ModeSetAccess ModeSet = iota // ModeSetSync: when push sync receipt is received ModeSetSync - // ModeSetRemove: when GC-d - ModeSetRemove + // modeSetRemove: when GC-d + // unexported as no external packages should remove chunks from database + modeSetRemove ) // Setter sets the state of a particular @@ -147,7 +148,7 @@ func (db *DB) set(mode ModeSet, addr storage.Address) (err error) { db.gcUncountedHashesIndex.PutInBatch(batch, item) db.incGCSize(1) - case ModeSetRemove: + case modeSetRemove: // delete from retrieve, pull, gc // need to get access timestamp here as it is not diff --git a/swarm/storage/localstore/mode_set_test.go b/swarm/storage/localstore/mode_set_test.go index 78adb15854..94cd0a3e2c 100644 --- a/swarm/storage/localstore/mode_set_test.go +++ b/swarm/storage/localstore/mode_set_test.go @@ -84,8 +84,8 @@ func TestModeSetSync(t *testing.T) { t.Run("gc size", newIndexGCSizeTest(db)) } -// TestModeSetRemoval validates ModeSetRemoval index values on the provided DB. -func TestModeSetRemoval(t *testing.T) { +// TestModeSetRemove validates ModeSetRemove index values on the provided DB. +func TestModeSetRemove(t *testing.T) { db, cleanupFunc := newTestDB(t, nil) defer cleanupFunc() @@ -96,7 +96,7 @@ func TestModeSetRemoval(t *testing.T) { t.Fatal(err) } - err = db.NewSetter(ModeSetRemove).Set(chunk.Address()) + err = db.NewSetter(modeSetRemove).Set(chunk.Address()) if err != nil { t.Fatal(err) }