Package distributor contains all the adaptors for the various supported distributor protocols. At a high level, it works like this:
* Quests specify a distributor configuration by name as part of their identity. * When an Execution for that Quest NeedsExecution, DM reads configuration (distributor.proto) from luci-config. This configuration is stored as part of the Execution so that for the duration of a given Exectuion, DM always interacts with the same distributor in the same way (barring code changes in DM's adapter logic itself). * DM uses the selected distributor implementation to start a task and record its Token. Additionally, the distributor SHOULD publish on DM's pubsub topic to update DM's state. When publishing updates, the distributor MUST include the token returned from PrepareTopic (or else the published update will be ignored). * When DM gets a hit on pubsub, it will load the Execution, load its cached distributor configuration, and then call HandleNotification for the adapter to parse the notification body and return the state of the task.
Adding a new distributor requires:
* Add a new subdir of protos with the configuration proto for the new distributor. Each distributor implementation must have its own unique Config message. * Add a matching subdir of this package for the implementation of the distributor. * In the implementation, add a Register method that registers the implementation with this package appropriately. * In the DM frontend, import your new package implementation and run its Register method.