apple / swift-cluster-membership

Distributed Membership Protocol implementations in Swift
https://apple.github.io/swift-cluster-membership/
Apache License 2.0
201 stars 20 forks source link

SwiftUI Visualization App #50

Open ktoso opened 4 years ago

ktoso commented 4 years ago

It would be fantastic if someone with better SwiftUI skillz than myself could help contribute a SwiftUI based visualization for those protocols, initially SWIM. It'd be a fantastic learning resource, very useful to explain how the dynamics of the protocol work etc.

This also shows how Swift is uniquely positioned to make such small helper / visualization apps for projects one is working on, which is kind of unique among other dist systems languages.

We'd want a visualization similar to what ShiViz is able to do: Screen Shot 2020-08-25 at 11 14 20

https://bestchai.bitbucket.io/shiviz/


So we'd want a "timeline" for each node, and lines between nodes when they perform sends to eachother. The lines should represent message sends, and dots the messages;

We can store the membership on every such call as well, and thanks to that we could on mouse over on a given node see what currently is the membership state on it.

This would likely want to use swift-tracing I suppose, though in reality the sequenceNumber is enough to perform the correlation, especially in SWIM where the messages are very simple and well known.

It would be great if we could build this as some form of visualizer.emit(message) since then we can implement it as an Instrument (from swift tracing) (!) most likely, and running with the visualizer would be the same as running any normal app but with the visualizer "enabled" (i.e. the VisualizerInstrument bootstrapped).

Happy to discuss ideas!