github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/pubsub/controller/messages.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package controller
     5  
     6  import "github.com/juju/juju/controller"
     7  
     8  // ConfigChanged messages are published by the apiserver client controller
     9  // facade whenever the controller config is updated.
    10  // data: `ConfigChangedMessage`
    11  const ConfigChanged = "controller.config-changed"
    12  
    13  // ConfigChangedMessage contains the controller.Config as it is after
    14  // the update. Despite the controller.Config being a map[string]interface{},
    15  // which also happens to be the default pubsub message payload, we wrap it
    16  // in a structure because the central hub annotates the serialised data structure
    17  // with, at least, the origin of the message.
    18  type ConfigChangedMessage struct {
    19  	Config controller.Config
    20  	// TODO(thumper): add a version int to allow out of order messages.
    21  	// Out of order could occur if two events happen simultaneously on two
    22  	// different machines, and the forwarding of those messages cross each other.
    23  	// Adding a version could allow subscribers to ignore lower versioned messages.
    24  }