mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 12:16:44 +00:00
DPA test with deleted memstore, localstore Put with background db access.
This commit is contained in:
parent
5ed5a5cbc2
commit
bea138d111
3 changed files with 16 additions and 2 deletions
|
|
@ -286,7 +286,6 @@ func (s *dbStore) Put(chunk *Chunk) {
|
|||
batch.Put(ikey, idata)
|
||||
|
||||
s.db.Write(batch)
|
||||
|
||||
}
|
||||
|
||||
// try to find index; if found, update access cnt and return true
|
||||
|
|
|
|||
|
|
@ -44,4 +44,19 @@ func TestDPA(t *testing.T) {
|
|||
if !bytes.Equal(slice, resultSlice) {
|
||||
t.Errorf("Comparison error.")
|
||||
}
|
||||
localStore.memStore = newMemStore(dbStore)
|
||||
resultReader = dpa.Retrieve(key)
|
||||
for i, _ := range resultSlice {
|
||||
resultSlice[i] = 0
|
||||
}
|
||||
n, err = resultReader.ReadAt(resultSlice, 0)
|
||||
if err != nil {
|
||||
t.Errorf("Retrieve error after removing memStore: %v", err)
|
||||
}
|
||||
if n != len(slice) {
|
||||
t.Errorf("Slice size error after removing memStore got %d, expected %d.", n, len(slice))
|
||||
}
|
||||
if !bytes.Equal(slice, resultSlice) {
|
||||
t.Errorf("Comparison error after removing memStore.")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ type localStore struct {
|
|||
// its integrity is checked ?
|
||||
func (self *localStore) Put(chunk *Chunk) {
|
||||
self.memStore.Put(chunk)
|
||||
self.dbStore.Put(chunk)
|
||||
go self.dbStore.Put(chunk)
|
||||
}
|
||||
|
||||
// Get(chunk *Chunk) looks up a chunk in the local stores
|
||||
|
|
|
|||
Loading…
Reference in a new issue