Restructure the composed store adaptors #2637
Open
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.
Motivation
We have the
Journaling
,ValueSplitting
,LruCaching
andMeteredStore
but the potential is not fully exploited with a relatively large quantity of boilerplate code.Proposal
The following was done:
get_name()
function is introduced to theAdminKeyValueStore
. Unfortunately, it was not possible to have a&'static str
since we want to have composed types and so composed names.get_name()
allows removing all theKeyValueStoreMetrics
static variables and instead having a global store that contains theKeyValueStoreMeytrics
.AdminKeyValueStore
trait function.AdminKeyValueStore
is added to all the Adaptor.LruCaching
this requires the introduction of theLruSplittingConfig
that contains the configurations in a nested way.CommonStoreConfig
is split with thecache_size
being removed from it.pub store
are systematically changed intostore
in the adaptors.Possible criticism of the design:
JournalingKeyValueStore
. The rust difficulty was in thetype Keys = K::Keys
since this requires a nested key type and I think it was a little too complicated at this time.KeyValueStoreMetrics
were previously as&'static LazyLock<KeyValueStoreMetrics>
. Now they are asArc<KeyValueStoreMetrics>
.LruSplittingError
. But those would be pure boilerplate since for LRU, there is no additional error occurring.Test Plan
CI. Nothing should be affected by the refactoring.
Release Plan
Not relevant.
Links
None.