core, eth, trie, xeth: merged state, chain, extra databases in one

This commit is contained in:
Jeffrey Wilcke
2015-08-06 19:57:39 +02:00
parent d7580f21f6
commit a23478c0be
21 changed files with 224 additions and 188 deletions

View File

@ -38,6 +38,8 @@ func NewCache(backend Backend) *Cache {
}
func (self *Cache) Get(key []byte) []byte {
key = append(StatePre, key...)
data := self.store[string(key)]
if data == nil {
data, _ = self.backend.Get(key)
@ -47,8 +49,8 @@ func (self *Cache) Get(key []byte) []byte {
}
func (self *Cache) Put(key []byte, data []byte) {
// write the data to the ldb batch
//self.batch.Put(key, rle.Compress(data))
key = append(StatePre, key...)
self.batch.Put(key, data)
self.store[string(key)] = data
}