2023-05-14 17:43:01 +00:00
|
|
|
# nimbus-eth1
|
|
|
|
# Copyright (c) 2021 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.
|
|
|
|
|
|
|
|
## In-memory backend for Aristo DB
|
|
|
|
## ===============================
|
2023-06-20 13:26:25 +00:00
|
|
|
##
|
|
|
|
## The iterators provided here are currently available only by direct
|
|
|
|
## backend access
|
|
|
|
## ::
|
|
|
|
## import
|
|
|
|
## aristo/aristo_init,
|
|
|
|
## aristo/aristo_init/aristo_memory
|
|
|
|
##
|
2023-08-07 17:45:23 +00:00
|
|
|
## let rc = newAristoDbRef(BackendMemory)
|
2023-06-20 13:26:25 +00:00
|
|
|
## if rc.isOk:
|
|
|
|
## let be = rc.value.to(MemBackendRef)
|
|
|
|
## for (n, key, vtx) in be.walkVtx:
|
|
|
|
## ...
|
|
|
|
##
|
2023-05-14 17:43:01 +00:00
|
|
|
{.push raises: [].}
|
|
|
|
|
|
|
|
import
|
2023-08-21 14:58:30 +00:00
|
|
|
std/[algorithm, options, sequtils, tables],
|
2023-06-30 22:22:33 +00:00
|
|
|
chronicles,
|
2023-06-20 13:26:25 +00:00
|
|
|
eth/common,
|
2023-09-12 18:45:12 +00:00
|
|
|
results,
|
2023-06-20 13:26:25 +00:00
|
|
|
../aristo_constants,
|
2023-06-12 13:48:47 +00:00
|
|
|
../aristo_desc,
|
2023-08-25 22:53:59 +00:00
|
|
|
../aristo_desc/desc_backend,
|
2023-06-20 13:26:25 +00:00
|
|
|
../aristo_transcode,
|
2023-08-25 22:53:59 +00:00
|
|
|
./init_common
|
2023-05-14 17:43:01 +00:00
|
|
|
|
|
|
|
type
|
2023-06-30 22:22:33 +00:00
|
|
|
MemBackendRef* = ref object of TypedBackendRef
|
2023-06-20 13:26:25 +00:00
|
|
|
## Inheriting table so access can be extended for debugging purposes
|
2023-08-18 19:46:55 +00:00
|
|
|
sTab: Table[VertexID,Blob] ## Structural vertex table making up a trie
|
2023-06-12 18:16:03 +00:00
|
|
|
kMap: Table[VertexID,HashKey] ## Merkle hash key mapping
|
2023-09-05 13:57:20 +00:00
|
|
|
rFil: Table[QueueID,Blob] ## Backend filters
|
2023-08-21 14:58:30 +00:00
|
|
|
vGen: Option[seq[VertexID]]
|
2023-08-25 22:53:59 +00:00
|
|
|
vFqs: Option[seq[(QueueID,QueueID)]]
|
2023-09-05 13:57:20 +00:00
|
|
|
noFq: bool ## No filter queues available
|
2023-06-09 11:17:37 +00:00
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
MemPutHdlRef = ref object of TypedPutHdlRef
|
2023-08-18 19:46:55 +00:00
|
|
|
sTab: Table[VertexID,Blob]
|
2023-06-20 13:26:25 +00:00
|
|
|
kMap: Table[VertexID,HashKey]
|
2023-08-25 22:53:59 +00:00
|
|
|
rFil: Table[QueueID,Blob]
|
2023-08-21 14:58:30 +00:00
|
|
|
vGen: Option[seq[VertexID]]
|
2023-08-25 22:53:59 +00:00
|
|
|
vFqs: Option[seq[(QueueID,QueueID)]]
|
2023-08-10 20:01:28 +00:00
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Private helpers
|
|
|
|
# ------------------------------------------------------------------------------
|
2023-06-09 11:17:37 +00:00
|
|
|
|
2023-06-30 22:22:33 +00:00
|
|
|
template logTxt(info: static[string]): static[string] =
|
|
|
|
"MemoryDB " & info
|
|
|
|
|
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
proc newSession(db: MemBackendRef): MemPutHdlRef =
|
|
|
|
new result
|
|
|
|
result.TypedPutHdlRef.beginSession db
|
|
|
|
|
|
|
|
proc getSession(hdl: PutHdlRef; db: MemBackendRef): MemPutHdlRef =
|
|
|
|
hdl.TypedPutHdlRef.verifySession db
|
|
|
|
hdl.MemPutHdlRef
|
|
|
|
|
|
|
|
proc endSession(hdl: PutHdlRef; db: MemBackendRef): MemPutHdlRef =
|
|
|
|
hdl.TypedPutHdlRef.finishSession db
|
|
|
|
hdl.MemPutHdlRef
|
2023-05-14 17:43:01 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
2023-06-20 13:26:25 +00:00
|
|
|
# Private functions: interface
|
2023-05-14 17:43:01 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
proc getVtxFn(db: MemBackendRef): GetVtxFn =
|
|
|
|
result =
|
|
|
|
proc(vid: VertexID): Result[VertexRef,AristoError] =
|
2023-08-18 19:46:55 +00:00
|
|
|
# Fetch serialised data record
|
|
|
|
let data = db.sTab.getOrDefault(vid, EmptyBlob)
|
|
|
|
if 0 < data.len:
|
|
|
|
let rc = data.deblobify VertexRef
|
|
|
|
if rc.isErr:
|
|
|
|
debug logTxt "getVtxFn() failed", vid, error=rc.error, info=rc.error
|
|
|
|
return rc
|
2023-06-20 13:26:25 +00:00
|
|
|
err(GetVtxNotFound)
|
2023-05-14 17:43:01 +00:00
|
|
|
|
|
|
|
proc getKeyFn(db: MemBackendRef): GetKeyFn =
|
|
|
|
result =
|
2023-06-12 18:16:03 +00:00
|
|
|
proc(vid: VertexID): Result[HashKey,AristoError] =
|
|
|
|
let key = db.kMap.getOrDefault(vid, VOID_HASH_KEY)
|
2023-06-22 11:13:24 +00:00
|
|
|
if key.isValid:
|
2023-05-30 21:21:15 +00:00
|
|
|
return ok key
|
2023-06-20 13:26:25 +00:00
|
|
|
err(GetKeyNotFound)
|
2023-05-14 17:43:01 +00:00
|
|
|
|
2023-08-22 18:44:54 +00:00
|
|
|
proc getFilFn(db: MemBackendRef): GetFilFn =
|
2023-09-05 13:57:20 +00:00
|
|
|
if db.noFq:
|
|
|
|
result =
|
|
|
|
proc(qid: QueueID): Result[FilterRef,AristoError] =
|
|
|
|
err(FilQuSchedDisabled)
|
|
|
|
else:
|
|
|
|
result =
|
|
|
|
proc(qid: QueueID): Result[FilterRef,AristoError] =
|
|
|
|
let data = db.rFil.getOrDefault(qid, EmptyBlob)
|
|
|
|
if 0 < data.len:
|
|
|
|
return data.deblobify FilterRef
|
|
|
|
err(GetFilNotFound)
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-06-09 11:17:37 +00:00
|
|
|
proc getIdgFn(db: MemBackendRef): GetIdgFn =
|
|
|
|
result =
|
|
|
|
proc(): Result[seq[VertexID],AristoError]=
|
2023-08-21 14:58:30 +00:00
|
|
|
if db.vGen.isSome:
|
|
|
|
return ok db.vGen.unsafeGet
|
|
|
|
err(GetIdgNotFound)
|
2023-06-09 11:17:37 +00:00
|
|
|
|
2023-08-25 22:53:59 +00:00
|
|
|
proc getFqsFn(db: MemBackendRef): GetFqsFn =
|
2023-09-05 13:57:20 +00:00
|
|
|
if db.noFq:
|
|
|
|
result =
|
|
|
|
proc(): Result[seq[(QueueID,QueueID)],AristoError] =
|
|
|
|
err(FilQuSchedDisabled)
|
|
|
|
else:
|
|
|
|
result =
|
|
|
|
proc(): Result[seq[(QueueID,QueueID)],AristoError] =
|
|
|
|
if db.vFqs.isSome:
|
|
|
|
return ok db.vFqs.unsafeGet
|
|
|
|
err(GetFqsNotFound)
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-06-09 11:17:37 +00:00
|
|
|
# -------------
|
|
|
|
|
|
|
|
proc putBegFn(db: MemBackendRef): PutBegFn =
|
|
|
|
result =
|
|
|
|
proc(): PutHdlRef =
|
2023-06-20 13:26:25 +00:00
|
|
|
db.newSession()
|
2023-06-09 11:17:37 +00:00
|
|
|
|
|
|
|
|
2023-05-14 17:43:01 +00:00
|
|
|
proc putVtxFn(db: MemBackendRef): PutVtxFn =
|
|
|
|
result =
|
2023-06-09 11:17:37 +00:00
|
|
|
proc(hdl: PutHdlRef; vrps: openArray[(VertexID,VertexRef)]) =
|
2023-06-20 13:26:25 +00:00
|
|
|
let hdl = hdl.getSession db
|
2023-06-30 22:22:33 +00:00
|
|
|
if hdl.error.isNil:
|
|
|
|
for (vid,vtx) in vrps:
|
2023-08-18 19:46:55 +00:00
|
|
|
if vtx.isValid:
|
|
|
|
let rc = vtx.blobify()
|
2023-06-30 22:22:33 +00:00
|
|
|
if rc.isErr:
|
|
|
|
hdl.error = TypedPutHdlErrRef(
|
|
|
|
pfx: VtxPfx,
|
|
|
|
vid: vid,
|
|
|
|
code: rc.error)
|
|
|
|
return
|
2023-08-18 19:46:55 +00:00
|
|
|
hdl.sTab[vid] = rc.value
|
|
|
|
else:
|
|
|
|
hdl.sTab[vid] = EmptyBlob
|
2023-05-14 17:43:01 +00:00
|
|
|
|
|
|
|
proc putKeyFn(db: MemBackendRef): PutKeyFn =
|
|
|
|
result =
|
2023-06-12 18:16:03 +00:00
|
|
|
proc(hdl: PutHdlRef; vkps: openArray[(VertexID,HashKey)]) =
|
2023-06-20 13:26:25 +00:00
|
|
|
let hdl = hdl.getSession db
|
2023-06-30 22:22:33 +00:00
|
|
|
if hdl.error.isNil:
|
|
|
|
for (vid,key) in vkps:
|
|
|
|
hdl.kMap[vid] = key
|
2023-05-14 17:43:01 +00:00
|
|
|
|
2023-08-22 18:44:54 +00:00
|
|
|
proc putFilFn(db: MemBackendRef): PutFilFn =
|
2023-09-05 13:57:20 +00:00
|
|
|
if db.noFq:
|
|
|
|
result =
|
|
|
|
proc(hdl: PutHdlRef; vf: openArray[(QueueID,FilterRef)]) =
|
|
|
|
let hdl = hdl.getSession db
|
|
|
|
if hdl.error.isNil:
|
|
|
|
hdl.error = TypedPutHdlErrRef(
|
|
|
|
pfx: FilPfx,
|
|
|
|
qid: (if 0 < vf.len: vf[0][0] else: QueueID(0)),
|
|
|
|
code: FilQuSchedDisabled)
|
|
|
|
else:
|
|
|
|
result =
|
|
|
|
proc(hdl: PutHdlRef; vf: openArray[(QueueID,FilterRef)]) =
|
|
|
|
let hdl = hdl.getSession db
|
|
|
|
if hdl.error.isNil:
|
|
|
|
for (qid,filter) in vf:
|
|
|
|
if filter.isValid:
|
|
|
|
let rc = filter.blobify()
|
|
|
|
if rc.isErr:
|
|
|
|
hdl.error = TypedPutHdlErrRef(
|
|
|
|
pfx: FilPfx,
|
|
|
|
qid: qid,
|
|
|
|
code: rc.error)
|
|
|
|
return
|
|
|
|
hdl.rFil[qid] = rc.value
|
|
|
|
else:
|
|
|
|
hdl.rFil[qid] = EmptyBlob
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-06-09 11:17:37 +00:00
|
|
|
proc putIdgFn(db: MemBackendRef): PutIdgFn =
|
|
|
|
result =
|
|
|
|
proc(hdl: PutHdlRef; vs: openArray[VertexID]) =
|
2023-06-20 13:26:25 +00:00
|
|
|
let hdl = hdl.getSession db
|
2023-06-30 22:22:33 +00:00
|
|
|
if hdl.error.isNil:
|
2023-08-21 14:58:30 +00:00
|
|
|
hdl.vGen = some(vs.toSeq)
|
2023-06-09 11:17:37 +00:00
|
|
|
|
2023-08-25 22:53:59 +00:00
|
|
|
proc putFqsFn(db: MemBackendRef): PutFqsFn =
|
2023-09-05 13:57:20 +00:00
|
|
|
if db.noFq:
|
|
|
|
result =
|
|
|
|
proc(hdl: PutHdlRef; fs: openArray[(QueueID,QueueID)]) =
|
|
|
|
let hdl = hdl.getSession db
|
|
|
|
if hdl.error.isNil:
|
|
|
|
hdl.error = TypedPutHdlErrRef(
|
|
|
|
pfx: AdmPfx,
|
|
|
|
code: FilQuSchedDisabled)
|
|
|
|
else:
|
|
|
|
result =
|
|
|
|
proc(hdl: PutHdlRef; fs: openArray[(QueueID,QueueID)]) =
|
|
|
|
let hdl = hdl.getSession db
|
|
|
|
if hdl.error.isNil:
|
|
|
|
hdl.vFqs = some(fs.toSeq)
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-06-09 11:17:37 +00:00
|
|
|
|
|
|
|
proc putEndFn(db: MemBackendRef): PutEndFn =
|
|
|
|
result =
|
2023-09-12 18:45:12 +00:00
|
|
|
proc(hdl: PutHdlRef): Result[void,AristoError] =
|
2023-06-20 13:26:25 +00:00
|
|
|
let hdl = hdl.endSession db
|
2023-06-30 22:22:33 +00:00
|
|
|
if not hdl.error.isNil:
|
2023-08-18 19:46:55 +00:00
|
|
|
case hdl.error.pfx:
|
|
|
|
of VtxPfx, KeyPfx:
|
|
|
|
debug logTxt "putEndFn: vtx/key failed",
|
|
|
|
pfx=hdl.error.pfx, vid=hdl.error.vid, error=hdl.error.code
|
2023-08-22 18:44:54 +00:00
|
|
|
of FilPfx:
|
|
|
|
debug logTxt "putEndFn: filter failed",
|
2023-08-25 22:53:59 +00:00
|
|
|
pfx=hdl.error.pfx, qid=hdl.error.qid, error=hdl.error.code
|
2023-08-18 19:46:55 +00:00
|
|
|
else:
|
|
|
|
debug logTxt "putEndFn: failed",
|
|
|
|
pfx=hdl.error.pfx, error=hdl.error.code
|
2023-09-12 18:45:12 +00:00
|
|
|
return err(hdl.error.code)
|
2023-06-20 13:26:25 +00:00
|
|
|
|
2023-08-18 19:46:55 +00:00
|
|
|
for (vid,data) in hdl.sTab.pairs:
|
|
|
|
if 0 < data.len:
|
|
|
|
db.sTab[vid] = data
|
2023-06-20 13:26:25 +00:00
|
|
|
else:
|
|
|
|
db.sTab.del vid
|
|
|
|
|
|
|
|
for (vid,key) in hdl.kMap.pairs:
|
|
|
|
if key.isValid:
|
|
|
|
db.kMap[vid] = key
|
|
|
|
else:
|
|
|
|
db.kMap.del vid
|
|
|
|
|
2023-08-25 22:53:59 +00:00
|
|
|
for (qid,data) in hdl.rFil.pairs:
|
2023-09-05 13:57:20 +00:00
|
|
|
if 0 < data.len:
|
2023-08-25 22:53:59 +00:00
|
|
|
db.rFil[qid] = data
|
2023-08-22 18:44:54 +00:00
|
|
|
else:
|
2023-08-25 22:53:59 +00:00
|
|
|
db.rFil.del qid
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-08-21 14:58:30 +00:00
|
|
|
if hdl.vGen.isSome:
|
|
|
|
let vGen = hdl.vGen.unsafeGet
|
|
|
|
if vGen.len == 0:
|
|
|
|
db.vGen = none(seq[VertexID])
|
|
|
|
else:
|
|
|
|
db.vGen = some(vGen)
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-08-25 22:53:59 +00:00
|
|
|
if hdl.vFqs.isSome:
|
|
|
|
let vFqs = hdl.vFqs.unsafeGet
|
|
|
|
if vFqs.len == 0:
|
|
|
|
db.vFqs = none(seq[(QueueID,QueueID)])
|
2023-08-22 18:44:54 +00:00
|
|
|
else:
|
2023-08-25 22:53:59 +00:00
|
|
|
db.vFqs = some(vFqs)
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-09-12 18:45:12 +00:00
|
|
|
ok()
|
2023-06-09 11:17:37 +00:00
|
|
|
|
|
|
|
# -------------
|
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
proc closeFn(db: MemBackendRef): CloseFn =
|
2023-05-14 17:43:01 +00:00
|
|
|
result =
|
2023-06-20 13:26:25 +00:00
|
|
|
proc(ignore: bool) =
|
|
|
|
discard
|
2023-05-14 17:43:01 +00:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Public functions
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2023-09-05 13:57:20 +00:00
|
|
|
proc memoryBackend*(qidLayout: QidLayoutRef): BackendRef =
|
|
|
|
let db = MemBackendRef(
|
|
|
|
beKind: BackendMemory,
|
|
|
|
noFq: qidLayout.isNil)
|
2023-06-20 13:26:25 +00:00
|
|
|
|
|
|
|
db.getVtxFn = getVtxFn db
|
|
|
|
db.getKeyFn = getKeyFn db
|
2023-08-22 18:44:54 +00:00
|
|
|
db.getFilFn = getFilFn db
|
2023-06-20 13:26:25 +00:00
|
|
|
db.getIdgFn = getIdgFn db
|
2023-08-25 22:53:59 +00:00
|
|
|
db.getFqsFn = getFqsFn db
|
2023-06-20 13:26:25 +00:00
|
|
|
|
|
|
|
db.putBegFn = putBegFn db
|
|
|
|
db.putVtxFn = putVtxFn db
|
|
|
|
db.putKeyFn = putKeyFn db
|
2023-08-22 18:44:54 +00:00
|
|
|
db.putFilFn = putFilFn db
|
2023-06-20 13:26:25 +00:00
|
|
|
db.putIdgFn = putIdgFn db
|
2023-08-25 22:53:59 +00:00
|
|
|
db.putFqsFn = putFqsFn db
|
2023-06-20 13:26:25 +00:00
|
|
|
db.putEndFn = putEndFn db
|
2023-05-14 17:43:01 +00:00
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
db.closeFn = closeFn db
|
2023-06-09 11:17:37 +00:00
|
|
|
|
2023-09-05 13:57:20 +00:00
|
|
|
# Set up filter management table
|
|
|
|
if not db.noFq:
|
|
|
|
db.filters = QidSchedRef(ctx: qidLayout)
|
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
db
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Public iterators (needs direct backend access)
|
|
|
|
# ------------------------------------------------------------------------------
|
2023-06-09 11:17:37 +00:00
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
iterator walkVtx*(
|
|
|
|
be: MemBackendRef;
|
|
|
|
): tuple[n: int, vid: VertexID, vtx: VertexRef] =
|
|
|
|
## Iteration over the vertex sub-table.
|
|
|
|
for n,vid in be.sTab.keys.toSeq.mapIt(it.uint64).sorted.mapIt(it.VertexID):
|
2023-08-18 19:46:55 +00:00
|
|
|
let data = be.sTab.getOrDefault(vid, EmptyBlob)
|
|
|
|
if 0 < data.len:
|
|
|
|
let rc = data.deblobify VertexRef
|
|
|
|
if rc.isErr:
|
|
|
|
debug logTxt "walkVtxFn() skip", n, vid, error=rc.error
|
|
|
|
else:
|
|
|
|
yield (n, vid, rc.value)
|
2023-06-20 13:26:25 +00:00
|
|
|
|
|
|
|
iterator walkKey*(
|
|
|
|
be: MemBackendRef;
|
|
|
|
): tuple[n: int, vid: VertexID, key: HashKey] =
|
|
|
|
## Iteration over the Markle hash sub-table.
|
|
|
|
for n,vid in be.kMap.keys.toSeq.mapIt(it.uint64).sorted.mapIt(it.VertexID):
|
|
|
|
let key = be.kMap.getOrDefault(vid, VOID_HASH_KEY)
|
|
|
|
if key.isValid:
|
|
|
|
yield (n, vid, key)
|
|
|
|
|
2023-08-22 18:44:54 +00:00
|
|
|
iterator walkFil*(
|
|
|
|
be: MemBackendRef;
|
2023-08-25 22:53:59 +00:00
|
|
|
): tuple[n: int, qid: QueueID, filter: FilterRef] =
|
2023-08-22 18:44:54 +00:00
|
|
|
## Iteration over the vertex sub-table.
|
2023-09-05 13:57:20 +00:00
|
|
|
if not be.noFq:
|
|
|
|
for n,qid in be.rFil.keys.toSeq.mapIt(it.uint64).sorted.mapIt(it.QueueID):
|
|
|
|
let data = be.rFil.getOrDefault(qid, EmptyBlob)
|
|
|
|
if 0 < data.len:
|
|
|
|
let rc = data.deblobify FilterRef
|
|
|
|
if rc.isErr:
|
|
|
|
debug logTxt "walkFilFn() skip", n,qid, error=rc.error
|
|
|
|
else:
|
|
|
|
yield (n, qid, rc.value)
|
2023-08-22 18:44:54 +00:00
|
|
|
|
|
|
|
|
2023-06-20 13:26:25 +00:00
|
|
|
iterator walk*(
|
|
|
|
be: MemBackendRef;
|
2023-08-18 19:46:55 +00:00
|
|
|
): tuple[n: int, pfx: StorageType, xid: uint64, data: Blob] =
|
2023-06-20 13:26:25 +00:00
|
|
|
## Walk over all key-value pairs of the database.
|
|
|
|
##
|
|
|
|
## Non-decodable entries are stepped over while the counter `n` of the
|
|
|
|
## yield record is still incremented.
|
2023-08-18 19:46:55 +00:00
|
|
|
var n = 0
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-08-21 14:58:30 +00:00
|
|
|
if be.vGen.isSome:
|
|
|
|
yield(0, AdmPfx, AdmTabIdIdg.uint64, be.vGen.unsafeGet.blobify)
|
2023-08-18 19:46:55 +00:00
|
|
|
n.inc
|
|
|
|
|
2023-09-05 13:57:20 +00:00
|
|
|
if not be.noFq:
|
|
|
|
if be.vFqs.isSome:
|
|
|
|
yield(0, AdmPfx, AdmTabIdFqs.uint64, be.vFqs.unsafeGet.blobify)
|
|
|
|
n.inc
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-08-18 19:46:55 +00:00
|
|
|
for vid in be.sTab.keys.toSeq.mapIt(it.uint64).sorted.mapIt(it.VertexID):
|
|
|
|
let data = be.sTab.getOrDefault(vid, EmptyBlob)
|
|
|
|
if 0 < data.len:
|
|
|
|
yield (n, VtxPfx, vid.uint64, data)
|
|
|
|
n.inc
|
|
|
|
|
|
|
|
for (_,vid,key) in be.walkKey:
|
|
|
|
yield (n, KeyPfx, vid.uint64, key.to(Blob))
|
|
|
|
n.inc
|
2023-05-14 17:43:01 +00:00
|
|
|
|
2023-09-05 13:57:20 +00:00
|
|
|
if not be.noFq:
|
|
|
|
for lid in be.rFil.keys.toSeq.mapIt(it.uint64).sorted.mapIt(it.QueueID):
|
|
|
|
let data = be.rFil.getOrDefault(lid, EmptyBlob)
|
|
|
|
if 0 < data.len:
|
|
|
|
yield (n, FilPfx, lid.uint64, data)
|
|
|
|
n.inc
|
2023-08-22 18:44:54 +00:00
|
|
|
|
2023-05-14 17:43:01 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# End
|
|
|
|
# ------------------------------------------------------------------------------
|