Node icon indicating copy to clipboard operation
Node copied to clipboard

Special serializer for NodeRecordInner_0v1

Open czarte opened this issue 11 months ago • 1 comments

create special serde serializer and deserializer for NodeRecordInner_0v1 to make storage of the data more efficient. Note that this will require use of the Gossip migration logic for the first time.

czarte avatar Feb 26 '25 16:02 czarte

There are two parts to this card, but they can't really be split.

First is implementing Serialize and Deserialize for NodeRecordInner_0v2. (We'll need to increment the version to 0v2 so that the Gossip migration logic will work correctly.)

As I remember, Serialize is quite easy to implement, as long as you have a good design in your head about how you want the data to be serialized into binary; but Deserialize is a bit more complex, because it involves compliance with a version of the Visitor pattern that serde requires. We've done it before several times (do a regex search through the codebase for impl.+Deserialize), so there are examples to work from, but deserializing NodeRecordInner_0v2 will be harder.

The second part is adding Gossip migration logic so that A) later-version Nodes that receive NodeRecordInner_0v1 Gossip can convert it into NodeRecordInner_0v2 structures and use it (note that NodeRecordInner_0v2 will probably look from the outside exactly like NodeRecordInner_0v1, but it'll need to be serialized and deserialized differently), and B) earlier-version Nodes that receive NodeRecordInner_0v2 Gossip can convert it into NodeRecordInner_0v1 structures.

B) may turn out to be impossible. If it is, then the new structure should be called NodeRecordInner_1v1, and the earlier and later Nodes will know that they can't talk to each other.

dnwiebe avatar Mar 02 '25 22:03 dnwiebe