mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-14 13:06:59 +00:00
Improve performance of DbGetHandler.
This commit is contained in:
parent
29002618a6
commit
09a9951a13
@ -457,14 +457,15 @@ proc adjustRadius(
|
||||
proc createGetHandler*(db: ContentDB): DbGetHandler =
|
||||
return (
|
||||
proc(contentKey: ContentKeyByteList, contentId: ContentId): Opt[seq[byte]] =
|
||||
var res = Opt.none(seq[byte])
|
||||
var res: seq[byte]
|
||||
|
||||
proc onData(data: openArray[byte]) =
|
||||
res = Opt.some(@data)
|
||||
res = @data
|
||||
|
||||
discard db.get(contentId, onData)
|
||||
|
||||
ensureMove(res)
|
||||
if db.get(contentId, onData):
|
||||
Opt.some(res)
|
||||
else:
|
||||
Opt.none(seq[byte])
|
||||
)
|
||||
|
||||
proc createStoreHandler*(db: ContentDB, cfg: RadiusConfig): DbStoreHandler =
|
||||
|
Loading…
x
Reference in New Issue
Block a user