controller.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package plugin
  2. import (
  3. "github.com/Sirupsen/logrus"
  4. "github.com/docker/swarmkit/api"
  5. "golang.org/x/net/context"
  6. )
  7. // Controller is the controller for the plugin backend
  8. type Controller struct{}
  9. // NewController returns a new cluster plugin controller
  10. func NewController() (*Controller, error) {
  11. return &Controller{}, nil
  12. }
  13. // Update is the update phase from swarmkit
  14. func (p *Controller) Update(ctx context.Context, t *api.Task) error {
  15. logrus.WithFields(logrus.Fields{
  16. "controller": "plugin",
  17. }).Debug("Update")
  18. return nil
  19. }
  20. // Prepare is the prepare phase from swarmkit
  21. func (p *Controller) Prepare(ctx context.Context) error {
  22. logrus.WithFields(logrus.Fields{
  23. "controller": "plugin",
  24. }).Debug("Prepare")
  25. return nil
  26. }
  27. // Start is the start phase from swarmkit
  28. func (p *Controller) Start(ctx context.Context) error {
  29. logrus.WithFields(logrus.Fields{
  30. "controller": "plugin",
  31. }).Debug("Start")
  32. return nil
  33. }
  34. // Wait causes the task to wait until returned
  35. func (p *Controller) Wait(ctx context.Context) error {
  36. logrus.WithFields(logrus.Fields{
  37. "controller": "plugin",
  38. }).Debug("Wait")
  39. return nil
  40. }
  41. // Shutdown is the shutdown phase from swarmkit
  42. func (p *Controller) Shutdown(ctx context.Context) error {
  43. logrus.WithFields(logrus.Fields{
  44. "controller": "plugin",
  45. }).Debug("Shutdown")
  46. return nil
  47. }
  48. // Terminate is the terminate phase from swarmkit
  49. func (p *Controller) Terminate(ctx context.Context) error {
  50. logrus.WithFields(logrus.Fields{
  51. "controller": "plugin",
  52. }).Debug("Terminate")
  53. return nil
  54. }
  55. // Remove is the remove phase from swarmkit
  56. func (p *Controller) Remove(ctx context.Context) error {
  57. logrus.WithFields(logrus.Fields{
  58. "controller": "plugin",
  59. }).Debug("Remove")
  60. return nil
  61. }
  62. // Close is the close phase from swarmkit
  63. func (p *Controller) Close() error {
  64. logrus.WithFields(logrus.Fields{
  65. "controller": "plugin",
  66. }).Debug("Close")
  67. return nil
  68. }