blockstore: Call LedgerColumn methods instead of Database #3650
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
#3603 is looking to introduce a change where the rocksdb keys (byte reference) will be stack-allocated instead of heap-allocated. In order to accomplish this, any method that provides a key (ie just about all of them) need to go through the
LedgerColumn
object since eachLedgerColumn
has a constant key length that is known at compile time.On the other hand, the
Database
functions that operate on aColumn
take aColumn
as a generic parameter. Since that function is generic over any column, the key must be heap allocated as we can't know what the key length will be until invocation. So, we need to phase out theDatabase
calls in order to work towards the stack allocated keys.This PR pulls breaks several commits out of #3603 to keep reviews smaller
Summary of Changes
Use the
LedgerColumn
objects inBlockstore
to performget()
anditer()
calls instead of getting it from theDatabase
object directly