7d9e1d8607
* Code cosmetics * Aristo+Kvt: Fix api wrappers why: Api setup killed the backend descriptor when backend mapping was disabled. * Aristo: Implement masked profiling entries why: Database backend should be listed but not counted in tally * CoreDb: Simplify backend() methods why: DBMS backend access Was provided very early and over engineered. Now there are only two backend machines, one for `Kvt` and the other one for an `Mpt` available only via new API. * CoreDb: Code cleanup regarding descriptor types * CoreDb: Refactor/redefine `persistent()` methods why: There were `persistent()` methods for any type of caching storage facilities `Kvt`, `Mpt`, `Phk`, and `Acc`. Now there is only a single `persistent()` method storing all facilities in tandem (similar to how transactions work.) For non shared `Kvt` tables, there is now an extra storage method `saveOffSite()`. * CoreDb lingo update: `trie` becomes `column` why: Notion of a `trie` is pretty much hidden by the new `CoreDb` api. Revealed are sort of database columns for accounts an storage data, any of which have an internal state represented by a Keccack hash. So a `trie` or `MPT` becomes a `column` and a `rootHash` becomes a column state. * Aristo: rename backend filed `filters` => `journal` * Update full sync logging details: + Disable eth handler noise while syncing + Log journal depth (if available) * Fix copyright year * Fix cruft and unwanted imports |
||
---|---|---|
.. | ||
backend | ||
base | ||
README.md | ||
base.nim | ||
base_iterators.nim | ||
base_iterators_persistent.nim | ||
core_apps_legacy.nim | ||
core_apps_newapi.nim | ||
memory_only.nim | ||
persistent.nim |
README.md
Core database replacement wrapper object
This wrapper replaces the TrieDatabaseRef and its derivatives by the new object CoreDbRef.
Relations to current TrieDatabaseRef implementation
Here are some incomplete translations for objects and constructors.
Object types:
Legacy notation | CoreDbRef based replacement |
---|---|
ChainDB | (don't use/avoid) |
ChainDbRef | CoreDbRef |
TrieDatabaseRef | CoreDbKvtRef |
HexaryTrie | CoreDbMptRef |
SecureHexaryTrie | CoreDbPhkRef |
DbTransaction | CoreDbTxRef |
TransactionID | CoreDbTxID |
Constructors:
Legacy notation | CoreDbRef based replacement |
---|---|
trieDB newChainDB("..") | newCoreDbRef(LegacyDbPersistent,"..") |
newMemoryDB() | newCoreDbRef(LegacyDbMemory) |
-- | |
initHexaryTrie(db,..) | db.mpt(..) (no pruning) |
db.mptPrune(..) (w/pruning true/false) | |
-- | |
initSecureHexaryTrie(db,..) | db.phk(..) (no pruning) |
db.phkPrune(..) (w/pruning true/false) | |
-- | |
newCaptureDB(db,memDB) | db.capture() (see below) |
Usage of the replacement wrapper
Objects pedigree:
CoreDbRef -- base descriptor
| | |
| | +--- CoreDbCtxRef -- MPT context descriptor
| | | |
| | | +-- CoreDbMptRef -- hexary trie instance
| | | | : :
| | | +-- CoreDbMptRef -- hexary trie instance
| | |
| | |
| | +---- CoreDbPhkRef -- pre-hashed key hexary trie instance
| | | : :
| | +---- CoreDbPhkRef -- pre-hashed key hexary trie instance
| |
| |
| +------ CoreDbKvtRef -- single static key-value table
|
|
+-------- CoreDbCaptRef -- tracer support descriptor
Instantiating legacy standard database object descriptors works as follows:
let
db = newCoreDbRef(..) # new base descriptor
mpt = db.mpt(..) # hexary trie/Merkle Patricia Tree
phk = db.phk(..) # pre-hashed key hexary trie/MPT
kvt = db.kvt # key-value table
Tracer support setup by hiding the current CoreDbRef behind a replacement:
let
capture = db.capture()
db = capture.recorder # use the recorder in place of db
...
for key,value in capture.recorder.kvt:
... # process recorded data