NewDatabase creates a backing store for state. The returned database is safe for concurrent use and retains cached trie nodes in memory. The pool is an optional intermediate trie-node memory pool between the low level storage layer and the high level trie abstraction.
(db database.Database)
| 76 | // intermediate trie-node memory pool between the low level storage layer and the |
| 77 | // high level trie abstraction. |
| 78 | func NewDatabase(db database.Database) Database { |
| 79 | csc, _ := lru.New(codeSizeCacheSize) |
| 80 | return &cachingDB{ |
| 81 | db: trie.NewDatabase(db), |
| 82 | codeSizeCache: csc, |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | type cachingDB struct { |
| 87 | db *trie.Database |
no outgoing calls