amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
17.96k stars 1.16k forks source link

are there any recipies how to model data structures properly for Gun? #1323

Closed rozek closed 1 year ago

rozek commented 1 year ago

From what I have learned so far I can deduce that key-value maps ("objects") are the primary data structure of Gun. And there seem to be "sets" that were implemented on top of that.

But what about other data structures? (Sparse) "arrays" could be implemented like objects after converting their indices to strings - but what about lists?

Are there any examples of how to share lists using Gun? (I'm particularly thinking of lists of individual objects - which can occur only once in that list - which may be easier to implement that lists of primitives)

Or how to model hierarchical data structures (aka trees, again with every node appearing only once)

While the contents of these data structures could be outdated, they should always be consistent as described above.

I already have some ideas - but I bet that others have already implemented and tested such structures - I just can't find them

Thanks in advance for any help!

amark commented 1 year ago

If this isn't clear from https://gun.eco/docs/Graphs willing to wiki edit it to improve? If you use a Node's ID (soul) in a set it will dedup, correct.