-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: swap Dashmap
for StaticFileWriters
on StaticFileProvider
#10089
Conversation
/// Static file writers for every known [`StaticFileSegment`]. | ||
#[derive(Debug, Default)] | ||
pub(crate) struct StaticFileWriters { | ||
headers: RwLock<Option<StaticFileProviderRW>>, | ||
transactions: RwLock<Option<StaticFileProviderRW>>, | ||
receipts: RwLock<Option<StaticFileProviderRW>>, | ||
} |
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.
ah I see this is now flattened.
imo this is a lot more readible.
blocking until the next release just in case |
|
||
fn deref(&self) -> &Self::Target { | ||
// This is always created by [`StaticFileWriters::get_or_create`] | ||
self.0.as_ref().expect("should exist") |
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.
self.0.as_ref().expect("should exist") | |
self.0.as_ref().expect("static file writer provider should be init") |
very hacky, but ok, since we don't have a trait for the static file writer providers here right, so can't do noop impl for ()
instead of Option<StaticFileProviderRW>
.
more verbose error message helps find it in the code base though, cause this is bound to cause a bug in future when we rebuild smthg in the bootstrap process.
in general - good call. was thinking after #10034, that it's better not to abstract away locks anywhere in the codebase with |
Introduces:
This allows holding mutable references to two different static file segment writers without risk of deadlocking. Which is not possible with dashmap
This allows reverting #10069 .
Run the script with 0/100 failures