-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ArcSwap to update Mint configuration at runtime #503
base: main
Are you sure you want to change the base?
Conversation
The main goal is to change settings without having multiple RwLock everywhere, instead having ArcSwap to update the configuration without having access to a mutable reference to the Mint. This will allow the RPC Server, or any other medium to update the Mint without minimum contention.
crates/cdk/src/mint/config.rs
Outdated
use crate::mint_url::MintUrl; | ||
|
||
/// Mint Inner configuration | ||
pub struct Inner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be pub
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that it is accessed through get_config()
(that I think I should rename to load()
), I think it should be pub, at least pub(crate).
I'll think if that can be transparent, with something like Deref or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these new names are better (9272347), what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s better. 👍
# -Z minimal-versions | ||
sync_wrapper = "0.1.2" | ||
bech32 = "0.9.1" | ||
arc-swap = "1.7.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deps under the -Z minimal-version comment are for deps that are not a direct dep of ours, but whatever dependency of ours that pull them in does not properly define their minimal version. Since this is a direct dep of ours can we just move this above the comment.
/// Mint Info | ||
pub mint_info: MintInfo, | ||
/// Mint Config | ||
pub config: SwappableConfig, | ||
/// Quotes ttl | ||
pub quote_ttl: QuoteTTL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think the quote_ttl should also be in the swapable config?
Description
The main goal is to change settings without having multiple RwLock everywhere, instead having ArcSwap to update the configuration without having access to a mutable reference to the Mint.
This will allow the RPC Server, or any other medium to update the Mint without minimum contention.
This is a pre-requisite for #476
Notes to the reviewers
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-check
before committing