mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-31 14:28:48 +00:00
d6a4205324
* Aristo+RocksDB: Update backend drivers why: RocksDB update allows use some of the newly provided methods which were previously implemented by using the very C backend (for the lack of NIM methods.) * Aristo+RocksDB: Simplify drivers wrapper * Kvt: Update backend drivers and wrappers similar to `Aristo` * Aristo+Kvm: Use column families for RocksDB * Aristo+MemoryDB: Code cosmetics * Aristo: Provide guest column family for export why: So `Kvt` can piggyback on `Aristo` so there avoiding to run a second DBMS system in parallel. * Kvt: Provide import mechanism for RoksDB guest column family why: So `Kvt` can piggyback on `Aristo` so there avoiding to run a second DBMS system in parallel. * CoreDb+Aristo: Run persistent `Kvt` DB piggybacked on `Aristo` why: Avoiding to run two DBMS systems in parallel. * Fix copyright year * Ditto
54 lines
1.5 KiB
Nim
54 lines
1.5 KiB
Nim
# nimbus-eth1
|
|
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
|
# Licensed under either of
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
# http://opensource.org/licenses/MIT)
|
|
# at your option. This file may not be copied, modified, or distributed
|
|
# except according to those terms.
|
|
|
|
## Rocks DB store data iterator
|
|
## ============================
|
|
##
|
|
{.push raises: [].}
|
|
|
|
import
|
|
eth/common,
|
|
rocksdb,
|
|
./rdb_desc
|
|
|
|
const
|
|
extraTraceMessages = false
|
|
## Enable additional logging noise
|
|
|
|
when extraTraceMessages:
|
|
import
|
|
chronicles
|
|
|
|
logScope:
|
|
topics = "aristo-rocksdb"
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Public iterators
|
|
# ------------------------------------------------------------------------------
|
|
|
|
iterator walk*(rdb: RdbInst): tuple[key: Blob, data: Blob] =
|
|
## Walk over all key-value pairs of the database.
|
|
##
|
|
## Non-decodable entries are stepped over and ignored.
|
|
block walkBody:
|
|
let rit = rdb.store.openIterator().valueOr:
|
|
when extraTraceMessages:
|
|
trace logTxt "walk", pfx="all", error
|
|
break walkBody
|
|
defer: rit.close()
|
|
|
|
for (key,val) in rit.pairs:
|
|
if 0 < key.len:
|
|
yield (key, val)
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# End
|
|
# ------------------------------------------------------------------------------
|