CenturyLinkLabs/panamax-fleet-adapter — pull request #9 by dharmamike (2014-12-03 16:23:47+00:00)
Title: Reworking the adapter to simplify

There are a few major changes here.

First, this PR introduces a ServiceMediator to manage Services. Rather than the router accessing Service instances or the Service class directly, it now works through the ServiceMediator. The mediator creates a collection of service prototypes based on the incoming service definitions from the remote agent. Then, based on the deployment counts for each service, it creates a collection of Services which will be used to generate the unit files in Fleet. This allows for a simplified ServiceSorter which now just does one thing: sorts services into a binary tree based on links.

Second, the introduction of the ServiceMediator also changes Services into dumb models with business logic only pertaining to how their state should be presented. The logic for creating, loading, starting, stoping, and fetching status for Services now resides in the ServiceMediator.

Lastly, this PR extracts the generation of the Fleet unit file service definition into a ServiceConverter which takes a Service and outputs the unit file contents as a String.

This PR does NOT include the feature for cleanup of units if the entire payload fails to start. That feature will be in another PR based on this branch.