mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
swarm/storage/localstore: unexport modeSetRemove
This commit is contained in:
parent
80c269b50d
commit
bca85efff9
3 changed files with 8 additions and 7 deletions
|
|
@ -212,7 +212,7 @@ func TestDB_gcIndex(t *testing.T) {
|
||||||
t.Run("remove one chunk", func(t *testing.T) {
|
t.Run("remove one chunk", func(t *testing.T) {
|
||||||
i := 3
|
i := 3
|
||||||
|
|
||||||
err := db.NewSetter(ModeSetRemove).Set(chunks[i].Address())
|
err := db.NewSetter(modeSetRemove).Set(chunks[i].Address())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,9 @@ const (
|
||||||
ModeSetAccess ModeSet = iota
|
ModeSetAccess ModeSet = iota
|
||||||
// ModeSetSync: when push sync receipt is received
|
// ModeSetSync: when push sync receipt is received
|
||||||
ModeSetSync
|
ModeSetSync
|
||||||
// ModeSetRemove: when GC-d
|
// modeSetRemove: when GC-d
|
||||||
ModeSetRemove
|
// unexported as no external packages should remove chunks from database
|
||||||
|
modeSetRemove
|
||||||
)
|
)
|
||||||
|
|
||||||
// Setter sets the state of a particular
|
// 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.gcUncountedHashesIndex.PutInBatch(batch, item)
|
||||||
db.incGCSize(1)
|
db.incGCSize(1)
|
||||||
|
|
||||||
case ModeSetRemove:
|
case modeSetRemove:
|
||||||
// delete from retrieve, pull, gc
|
// delete from retrieve, pull, gc
|
||||||
|
|
||||||
// need to get access timestamp here as it is not
|
// need to get access timestamp here as it is not
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,8 @@ func TestModeSetSync(t *testing.T) {
|
||||||
t.Run("gc size", newIndexGCSizeTest(db))
|
t.Run("gc size", newIndexGCSizeTest(db))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestModeSetRemoval validates ModeSetRemoval index values on the provided DB.
|
// TestModeSetRemove validates ModeSetRemove index values on the provided DB.
|
||||||
func TestModeSetRemoval(t *testing.T) {
|
func TestModeSetRemove(t *testing.T) {
|
||||||
db, cleanupFunc := newTestDB(t, nil)
|
db, cleanupFunc := newTestDB(t, nil)
|
||||||
defer cleanupFunc()
|
defer cleanupFunc()
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ func TestModeSetRemoval(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = db.NewSetter(ModeSetRemove).Set(chunk.Address())
|
err = db.NewSetter(modeSetRemove).Set(chunk.Address())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue