8727307ef4
* Provide dedicated functions for deleteing accounts and storage trees why: Storage trees are always linked to an account, so there is no need for an application to fiddle about (e.g. re-cycling, unlinking) storage tree vertex IDs. * Remove `delete()` and other cruft from API, `aristo_delete`, etc. * clean up delete functions details: The delete implementations `deleteImpl()` and `delTreeImpl()` do not need to be super generic anymore as all the edge cases are covered by the specialised `deleteAccountPayload()`, `deleteGenericData()`, etc. * Avoid unnecessary re-calculations of account keys why: The function `registerAccountForUpdate()` did extract the storage ID (if any) and automatically marked the Merkle keys along the account path for re-hashing. This would also apply if there was later detected that the account or the storage tree did not need to be updated. So the `registerAccountForUpdate()` function was split into a part which retrieved the storage ID, and another one which marked the Merkle keys for re-calculation to be applied only when needed. |
||
---|---|---|
.. | ||
base | ||
README.md | ||
accounts_ledger.nim | ||
base.nim | ||
base_iterators.nim | ||
distinct_ledgers.nim |
README.md
The file accounts_cache.nim
has been relocated
Background
The new LedgerRef module unifies different implementations of the legacy accounts_cache. It is intended to be used as new base method for all of the AccountsCache implementations. The legacy accounts_cache version has been removed.
This was needed to accomodate for different CoreDb API paradigms. While the overloaded legacy AccountsCache implementation is just a closure based wrapper around the accounts_cache module, the overloaded AccountsLedgerRef is a closure based wrapper around the accounts_ledger module with the new CoreDb API returning Result[] values and saparating the meaning of trie root hash and trie root reference.
This allows to use the legacy hexary database (with the new CoreDb API) as well as the Aristo database (only supported on new API.)
Instructions
Legacy notation | LedgerRef replacement | Comment |
---|---|---|
import accounts_cache | import ledger | preferred method, |
AccountsCache.init(..) | AccountsCache.init(..) | wraps AccountsCache |
methods | ||
or | ||
import ledger/accounts_cache | stay with legacy | |
AccountsCache.init(..) | version of | |
AccountsCache | ||
-- | ||
fn(ac: AccountsCache) | fn(ac: LedgerRef) | function example for |
preferred wrapper | ||
or | method | |
fn(ac: AccountsCache) | with legacy version, | |
no change here |
The constructor decides which CoreDb API is to be used
Legacy API constructor | new API Constructor |
---|---|
import ledger | import ledger |
let w = AccountsCache.init(..) | let w = AccountsLedgerRef.init(..) |