Remove Fx from server implementation #138
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Embedding a Wetware server in a third-party application is currently tedious due to extensive boilerplate. This boilerplate comes from three sources:
pkg/server
uses Fx for dependency-injection but nonetheless requires us to instantiate, configure, start and stop the Fx application itself.server.Node
comprises multiple sub-services whose startup/shutdown logic logic needs to be carefully orchestrated.pkg/server
exposes a lot of internals.The goal of this PR is to provide a dead-simple mechanism for embedding servers. It adds a top level
server/
package, within which all three sources of complexity are remedied as follows:Serve
/ListenAndServe
methods, similar tonet/http
A wetware server is now embedded as follows:
Contrary to the previous version, server capabilities are not directly accessible since there is no equivalent of the
server.Node
type. Applications requiring access to the server's capability will have to dial a client connection to the local server. Future work will facilitate this.