mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-04 16:25:10 +00:00
Remove getSszDecoded from ContentDb.
This commit is contained in:
parent
15a224a424
commit
29ed761111
@ -296,16 +296,6 @@ proc get(kv: KvStoreRef, key: openArray[byte]): Opt[seq[byte]] =
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
proc getSszDecoded(kv: KvStoreRef, key: openArray[byte], T: type auto): Opt[T] =
|
|
||||||
let res = kv.get(key)
|
|
||||||
if res.isSome():
|
|
||||||
try:
|
|
||||||
Opt.some(SSZ.decode(res.get(), T))
|
|
||||||
except SerializationError:
|
|
||||||
raiseAssert("Stored data should always be serialized correctly")
|
|
||||||
else:
|
|
||||||
Opt.none(T)
|
|
||||||
|
|
||||||
## Private ContentDB calls
|
## Private ContentDB calls
|
||||||
|
|
||||||
proc get(db: ContentDB, key: openArray[byte]): Opt[seq[byte]] =
|
proc get(db: ContentDB, key: openArray[byte]): Opt[seq[byte]] =
|
||||||
@ -321,9 +311,6 @@ proc del(db: ContentDB, key: openArray[byte]) =
|
|||||||
# TODO: Do we want to return the bool here too?
|
# TODO: Do we want to return the bool here too?
|
||||||
discard db.kv.del(key).expectDb()
|
discard db.kv.del(key).expectDb()
|
||||||
|
|
||||||
proc getSszDecoded(db: ContentDB, key: openArray[byte], T: type auto): Opt[T] =
|
|
||||||
db.kv.getSszDecoded(key, T)
|
|
||||||
|
|
||||||
## Public ContentId based ContentDB calls
|
## Public ContentId based ContentDB calls
|
||||||
|
|
||||||
# TODO: Could also decide to use the ContentKey SSZ bytestring, as this is what
|
# TODO: Could also decide to use the ContentKey SSZ bytestring, as this is what
|
||||||
@ -347,9 +334,6 @@ proc contains*(db: ContentDB, key: ContentId): bool =
|
|||||||
proc del*(db: ContentDB, key: ContentId) =
|
proc del*(db: ContentDB, key: ContentId) =
|
||||||
db.del(key.toBytesBE())
|
db.del(key.toBytesBE())
|
||||||
|
|
||||||
proc getSszDecoded*(db: ContentDB, key: ContentId, T: type auto): Opt[T] =
|
|
||||||
db.getSszDecoded(key.toBytesBE(), T)
|
|
||||||
|
|
||||||
## Pruning related calls
|
## Pruning related calls
|
||||||
|
|
||||||
proc deleteContentFraction*(
|
proc deleteContentFraction*(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user