Conversation
ed255
left a comment
There was a problem hiding this comment.
LGTM! I've left two comments.
One is a small suggestion, the other is more a question/discussion.
| // } | ||
| // } | ||
| impl MockSignedPod { | ||
| pub fn deserialize(id: PodId, signature: String, kvs: HashMap<Key, Value>) -> Self { |
There was a problem hiding this comment.
this looks like a constructor with a different name :P
Will this method be used externally? If not, can we make it pub(crate)?
There was a problem hiding this comment.
It does have to be public if we want users of the library to be able to deserialize SignedPods.
There was a problem hiding this comment.
Won't users of the library interface the library through the frontend? And deserialize frontend::SignedPod (which internally deserializes MockSignedPod)?
There was a problem hiding this comment.
Oh, sorry, you're quite right. I'll make it pub(crate).
| @@ -30,10 +30,9 @@ impl TryFrom<SignedPodHelper> for SignedPod { | |||
| return Err(anyhow::anyhow!("pod_type is not Mock")); | |||
There was a problem hiding this comment.
What about deserializing a non-mock SignedPod?
Would this implementation have a switch here?
Same for the MainPod.
There was a problem hiding this comment.
When I first wrote this, there were no non-mock SignedPods! Are the new non-mock Pods usable enough for me to implement serialization for them?
There was a problem hiding this comment.
Both the non-mock SignedPod and MainPod should be ready enough to get serialization and deserialization :)
I would suggest doing that in another PR though.
aefc054 to
68b004e
Compare
Closes #195
Re-implements serialization based on the new refactored code.
Serialization format should be pretty similar to how it was before, with some small cosmetic changes.
I've had to implement a few more custom serialization functions, in order to avoid serializing middleware data. I've commented in the places where this was necessary, so that we can be aware that those custom serialization functions will not automatically track changes to the types in the way that Serde's attribute-based serialization does.
The new version has more tests, and in particular has an end-to-end test which: