core: move write caching layer into MemCacheStore

Simplify Blockchain and associated functions, deduplicate code, fix Get() and
Seek() implementations.
This commit is contained in:
Roman Khimov 2019-10-16 16:41:50 +03:00
parent 4822c736bb
commit fc0031e5aa
10 changed files with 283 additions and 197 deletions

View file

@ -18,11 +18,11 @@ type interopContext struct {
trigger byte
block *Block
tx *transaction.Transaction
mem *storage.MemoryStore
mem *storage.MemCachedStore
}
func newInteropContext(trigger byte, bc Blockchainer, block *Block, tx *transaction.Transaction) *interopContext {
mem := storage.NewMemoryStore()
func newInteropContext(trigger byte, bc Blockchainer, s storage.Store, block *Block, tx *transaction.Transaction) *interopContext {
mem := storage.NewMemCachedStore(s)
return &interopContext{bc, trigger, block, tx, mem}
}