wetware / pkg

Peer-to-peer cloud environment
https://wetware.run
Other
38 stars 7 forks source link

Refactor server code #77

Closed lthibault closed 1 year ago

lthibault commented 1 year ago

We previously factored *pubsub.PubSub out of CASM to greatly simplify the lifecycle logic of the CASM cluster model. The flip side of this is that we find ourselves holding two objects on the Wetware side that really ought to be merged into one object: server.Router (wetware) and cluster.Router (casm).

This PR introduces the Cluster interface, which abstracts the binding of these two types. Along the way, it cleans up a few symbol names and does some minor refactoring of configuration logic in Joiner (e.g. avoiding duplicate params, and passing stateful dependencies as function arguments).


cc @evan-schott and @mikelsr because this is a very simple change to the code responsible for starting a server when you run ww start. I thought it might be illuminating in terms of general architectural knowledge.