-
Notifications
You must be signed in to change notification settings - Fork 10
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
Modularize database initialization #65
Conversation
b599f27
to
3b2b091
Compare
5049ed7
to
83408fe
Compare
83c878c
to
6d3da4d
Compare
@@ -180,7 +180,7 @@ impl RevisionTracker { | |||
fn get_revision(&self, index: usize) -> Revision<SharedStore> { | |||
self.db | |||
.get_revision(&self.hashes[index], None) | |||
.expect(&format!("revision-{index} should exist")) | |||
.unwrap_or_else(|| panic!("revision-{index} 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.
Wondering why the change, is unwrap_or_else
is better than expect
?
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.
This was recommended by clippy with a few extra warnings turned on. Reason: format is built into panic, and it won't evaluate/compute the string until the panic actually happens (I think, not 100% sure)
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.
@@ -581,9 +579,12 @@ impl DiskBufferRequester { | |||
} | |||
|
|||
/// Initialize the Wal. | |||
pub fn init_wal(&self, waldir: &str, rootpath: PathBuf) { | |||
pub fn init_wal(&self, waldir: &str, rootpath: &Path) { |
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.
Why do we change this to &Path
as downstream is PathBuf
?
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 answer was in the commit comment for the second commit, probably not easy to find. The idea is that I want to defer cloning the dbpath because I want it after init_wal is finished.
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.
Allocation should be explicit, not hidden. I don't quite understand the motivation here.
35ac003
to
6dc0fbb
Compare
This moves DBConfig and DBRevConfig into a new config dir allowing these configs to be fetched from elsewhere
Want access to it after the last init_wal for better errors
6dc0fbb
to
2d3d5e2
Compare
Pretty tough to implement v2 of the API since things are so tied to the db implementation.
This group of commits splits the db.rs file into parts, documenting the opening of the database as I go.