Use Arc<Store> instead of Store for lazy loading #151
Closed
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.
Description
Change store's type used in
Router
andExtract
to wrapped one, to load configurations after extraction.This change affects to public trait.
Motivation and Context
Sometimes we define services for SoC. They would be dependent on another services.
Tide has per-endpoint configuration, so every services should be able to read it.
One way for it is passing a store's reference in services' constructor recursively while extraction. This looks good, but if some services depend on same services, duplicate object will be created.
Another way is extract (partial) clone of store and share it across services. If the store is big, per-request clone will be high cost.
This change helps latter one. Instead of cloning a store directly, we can clone just shared reference with few overhead.
How Has This Been Tested?
There are no additional tests.
Implementations of
Extract
are affected, but it can be easily fixed.Types of changes
Checklist: