started moving logic from bzz-fefe

This commit is contained in:
Daniel A. Nagy 2015-02-01 16:48:47 +01:00
parent 4ea99e804f
commit 99190409dd

View file

@ -10,12 +10,14 @@ const (
maxEntries = 500 // max number of stored (cached) blocks maxEntries = 500 // max number of stored (cached) blocks
memTreeLW = 2 // log2(subtree count) of the subtrees memTreeLW = 2 // log2(subtree count) of the subtrees
memTreeFLW = 14 // log2(subtree count) of the root layer memTreeFLW = 14 // log2(subtree count) of the root layer
dbForceUpdateAccessCnt = 1000
) )
type dpaMemStorage struct { type dpaMemStorage struct {
memtree *dpaMemTree memtree *dpaMemTree
entry_cnt uint // stored entries entry_cnt uint // stored entries
access_cnt uint64 // access counter; oldest is thrown away when full access_cnt uint64 // access counter; oldest is thrown away when full
dbAccessCnt uint64
} }
/* /*
@ -76,6 +78,7 @@ type dpaMemTree struct {
width uint // subtree count width uint // subtree count
entry *Chunk // if subtrees are present, entry should be nil entry *Chunk // if subtrees are present, entry should be nil
lastDBaccess uint64
access []uint64 access []uint64
} }
@ -177,6 +180,7 @@ func (s *dpaMemStorage) add(entry *Chunk) {
} }
node.entry = entry node.entry = entry
node.lastDBaccess = s.dbAccessCnt
node.update_access(s.access_cnt) node.update_access(s.access_cnt)
s.entry_cnt++ s.entry_cnt++