jrhy / mast

Go immutable, versioned, diffable map implementation of Merkle Search Trees
Mozilla Public License 2.0
43 stars 4 forks source link

About node encoding and decoding #78

Closed icexin closed 3 years ago

icexin commented 3 years ago

How to implement Marshal and Unmarshal in RemoteConfig to serialize nodes more compactly?

Thank you!

jrhy commented 3 years ago

Hi, thanks for the question! I added an example called TestCustomMarshal in 1.1.3. You may also be interested in the use like s3db does to setup gob.

Please let me know if that helps. Cheers!

icexin commented 3 years ago

Thanks for your reply. Gob is a more compact encoding format than JSON, but it is exclusive to go, which is not convenient for other languages to parse. In addition, it will add additional type information every time it is encoded. In fact, the type information of the codec involved in the mast code is determined, such as mastNode, so a schemaless codec will be more efficient. I will post a PR later to express my thoughts.