|
|
|
@ -55,9 +55,12 @@ type backend interface { |
|
|
|
|
// according to the state scheme.
|
|
|
|
|
Initialized(genesisRoot common.Hash) bool |
|
|
|
|
|
|
|
|
|
// Size returns the current storage size of the memory cache in front of the
|
|
|
|
|
// persistent database layer.
|
|
|
|
|
Size() common.StorageSize |
|
|
|
|
// Size returns the current storage size of the diff layers on top of the
|
|
|
|
|
// disk layer and the storage size of the nodes cached in the disk layer.
|
|
|
|
|
//
|
|
|
|
|
// For hash scheme, there is no differentiation between diff layer nodes
|
|
|
|
|
// and dirty disk layer nodes, so both are merged into the second return.
|
|
|
|
|
Size() (common.StorageSize, common.StorageSize) |
|
|
|
|
|
|
|
|
|
// Update performs a state transition by committing dirty nodes contained
|
|
|
|
|
// in the given set in order to update state from the specified parent to
|
|
|
|
@ -165,18 +168,19 @@ func (db *Database) Commit(root common.Hash, report bool) error { |
|
|
|
|
return db.backend.Commit(root, report) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Size returns the storage size of dirty trie nodes in front of the persistent
|
|
|
|
|
// database and the size of cached preimages.
|
|
|
|
|
func (db *Database) Size() (common.StorageSize, common.StorageSize) { |
|
|
|
|
// Size returns the storage size of diff layer nodes above the persistent disk
|
|
|
|
|
// layer, the dirty nodes buffered within the disk layer, and the size of cached
|
|
|
|
|
// preimages.
|
|
|
|
|
func (db *Database) Size() (common.StorageSize, common.StorageSize, common.StorageSize) { |
|
|
|
|
var ( |
|
|
|
|
storages common.StorageSize |
|
|
|
|
diffs, nodes common.StorageSize |
|
|
|
|
preimages common.StorageSize |
|
|
|
|
) |
|
|
|
|
storages = db.backend.Size() |
|
|
|
|
diffs, nodes = db.backend.Size() |
|
|
|
|
if db.preimages != nil { |
|
|
|
|
preimages = db.preimages.size() |
|
|
|
|
} |
|
|
|
|
return storages, preimages |
|
|
|
|
return diffs, nodes, preimages |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Initialized returns an indicator if the state data is already initialized
|
|
|
|
|