-
Notifications
You must be signed in to change notification settings - Fork 353
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
Publish snapshot map changelog #622
Conversation
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.
LGTM.
Does this solve your issue @ben2x4 ?
Tried to extend this to |
But see latest version. |
50ac360
to
1379d16
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.
Makes sense. Minor style comment
|
||
pub fn changelog(&self) -> Map<u64, ChangeSet<T>> { | ||
// Build and return a compatible Map with the proper key type | ||
Map::new(unsafe { from_utf8_unchecked(self.snapshots.changelog.namespace()) }) |
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 not expose this functionality as a method on Snapshot? (self.snapshots.changelog()
)
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.
No, because I'm overriding the changelog map key type here. Our empty (Unit
) keys have a particular behaviour, in that they are not length-prefixed zero-length elements in tuples (they are just being skipped, when building the key).
Anyway, that's another issue, and (in this case) due to an implementation detail. What I can do to improve on this is to save the changelog namespace in this class, so that I can use it here directly, and avoid the re-conversion to string. Will do.
Yes, I like this approach. Give the user direct access to the changelog without making the whole underlying snapshot item public, very good compromise between the two approaches I suggested. Thanks so much @maurolacy! |
25d37ad
to
011fa15
Compare
011fa15
to
a797917
Compare
Related to #600 and #621.
To allow prefixing / iteration over the changelog entries.