Conversation
|
Tried to extend this to |
But see latest version. |
50ac360 to
1379d16
Compare
ethanfrey
left a comment
There was a problem hiding this comment.
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.
Why not expose this functionality as a method on Snapshot? (self.snapshots.changelog())
There was a problem hiding this comment.
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.