Remove getSszDecoded from ContentDb.

This commit is contained in:
bhartnett 2024-11-01 11:16:17 +08:00
parent 15a224a424
commit 29ed761111
No known key found for this signature in database
GPG Key ID: 076F2830DA6BD535

View File

@ -296,16 +296,6 @@ proc get(kv: KvStoreRef, key: openArray[byte]): Opt[seq[byte]] =
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
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?
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
# 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) =
db.del(key.toBytesBE())
proc getSszDecoded*(db: ContentDB, key: ContentId, T: type auto): Opt[T] =
db.getSszDecoded(key.toBytesBE(), T)
## Pruning related calls
proc deleteContentFraction*(