-
Notifications
You must be signed in to change notification settings - Fork 439
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
std::fmt::Debug for Layer implementations #3536
Conversation
seems it was not used from anywhere.
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.
Nice job!
This should probably wait eviction related stats because we might want to include those. |
After looking a bit how to use this on the new evict_layer endpoint, I am thinking I'll just separate that to different PR altogether (with the c8b3139). |
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'm a bit sad that it makes it harder (at least, a bigger patch) to go away from the "&dyn Trait
as an interface" approach, but otherwise looks good.
@SomeoneToIgnore please elaborate how will this make it more difficult? I think the main point is that we should have |
Maybe I'm wrong, just imagined that now every place with |
Oki now I understood. I think in future it's just important to use I don't want to drop fields (above discussion on RemoteLayer I'm keeping open) or add newtypes which would suppress any long output (InMemoryLayer's index) to move towards that on this PR but having |
Follow-up to #3536, to actually use the new `Debug` in replacing the layers, and use replacement with manual eviction endpoint. Turns out the two paths share a lot of handling of `Replacement` but didn't unify the two (need 3). There are also upcoming refactorings from other PRs to this.
#3536 added the custom Debug implementations but it using derived Debug on Key lead to too verbose output. Instead of making `Key`'s `Debug` unconditionally or conditionally do the `Display` variant (for table space'd keys), opted to build a newtype to provide `Debug` for `Range<Key>` via `Display` which seemed to work unconditionally. Also orders Key to have: 1. comment, 2. derive, 3. `struct Key`.
Follow-up to #3513.
This removes the old blanket
std::fmt::Debug
impl ondyn Layer
which did not seem to be used from anywhere (no compilation errors after removing).Adds
std::fmt::Debug
requirement and implementations fortrait Layer
implementors:Adds and adjusts some doc comments to be more rustdoc alike.
In follow-up #3544: Use this
std::fmt::Debug
when logging aLayerMap::replace
failure for which we currently have no tests but speculation (see #3387 comments).Alternatives for adding the
std::fmt::Debug
:Layer::get_type_name(&self) -> &'static str
std::fmt::Debug
alike functionality to the traitstd::fmt::Debug
is the way to debug format objects