-
Notifications
You must be signed in to change notification settings - Fork 44
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
Extract common object store key builder helpers #2438
base: main
Are you sure you want to change the base?
Conversation
269f4f1
to
45583ac
Compare
45583ac
to
aea27d7
Compare
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.
Thank you so much @pcholakov for this PR. The changes looks good to me.
I think also it can be handy to use Path in place of String for paths. It can be very handy specially when using it with .child()
method where u can chain paths naturally without the need to use format!
string.
let prefix = Path::from("prefix");
let child1 = prefix.child("child1");
let deep = prefix.child("child2").child("deep");
pub fn from_snapshot(snapshot: &PartitionSnapshotMetadata, path: String) -> Self { | ||
pub fn from_snapshot( | ||
snapshot: &PartitionSnapshotMetadata, | ||
snapshot_unique_key: String, |
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 really recommend to create a wrapper type on top of String
. For example struct PaddedSnapshotKey(String)
or even better struct PaddedSnapshotKey{min_applied_lsn, snapshot_id}
and then build string when it's needed
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 like this a lot! 👍
The reason I've been avoiding |
The join method for the |
🤦♂️ |
Thank you for the suggestions @muhamadazmy, this is much better! |
This PR factors out the object store key construction logic into a few methods that are easier to follow and reuse.
Closes: #2389