-
Notifications
You must be signed in to change notification settings - Fork 1
[fix][core] Single-lock max_level computation #129
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
Changes from all commits
95bc3cc
90ca56d
749ad5e
37a8089
fc3e9a8
b9ff3ed
df1780b
e536718
b0fc637
7e93884
58a11a9
b713662
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ use crate::core::model::direction::Direction; | |
| use crate::core::{ | ||
| IdSearchReq, IdSearchRes, Identifier, LookupTable, LookupTableLevel, MembershipVector, | ||
| }; | ||
| use anyhow::{anyhow, Context}; | ||
| use anyhow::anyhow; | ||
| use tracing::Span; | ||
|
|
||
| /// Core is the pure-local interface for a skip-graph node's algorithms. | ||
|
|
@@ -204,21 +204,7 @@ impl Core for BaseCore { | |
| } | ||
|
|
||
| fn max_level(&self) -> anyhow::Result<LookupTableLevel> { | ||
| let left = self | ||
| .lt | ||
| .left_neighbors() | ||
| .context("failed to read left neighbors from lookup table")?; | ||
| let right = self | ||
| .lt | ||
| .right_neighbors() | ||
| .context("failed to read right neighbors from lookup table")?; | ||
|
|
||
| Ok(left | ||
| .iter() | ||
| .chain(right.iter()) | ||
| .map(|(level, _)| *level) | ||
| .max() | ||
| .unwrap_or(0)) | ||
| Ok(self.lt.max_populated_level().unwrap_or(0)) | ||
| } | ||
|
Comment on lines
206
to
208
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Core::max_level's # Errors section documents the trait's general contract (a future Core impl could genuinely fail reading its own storage), not a guarantee this specific implementation exercises it, that signature predates this PR and is out of scope here. BaseCore's own impl just has no failure path left, so the old error-propagation test was removed since there's nothing left for it to exercise. No doc change needed on the trait itself. |
||
|
|
||
| fn prefix_match(&self, candidate: MembershipVector, level: LookupTableLevel) -> bool { | ||
|
|
||
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.
Intentional deviation, not an oversight. Result was dead weight here (no level arg to bounds-check, RwLock::read() doesn't poison), so I dropped it rather than keep a wrapper that could never be Err. Called this out explicitly in the PR description now.