diff --git a/consul/coordinate_endpoint.go b/consul/coordinate_endpoint.go new file mode 100644 index 0000000000..41425519ce --- /dev/null +++ b/consul/coordinate_endpoint.go @@ -0,0 +1,5 @@ +package consul + +type Coordinate struct { + srv *Server +} diff --git a/consul/server.go b/consul/server.go index 528b6f16ac..8cdbe17586 100644 --- a/consul/server.go +++ b/consul/server.go @@ -144,13 +144,14 @@ type Server struct { // Holds the RPC endpoints type endpoints struct { - Catalog *Catalog - Health *Health - Status *Status - KVS *KVS - Session *Session - Internal *Internal - ACL *ACL + Catalog *Catalog + Health *Health + Status *Status + KVS *KVS + Session *Session + Internal *Internal + ACL *ACL + Coordinate *Coordinate } // NewServer is used to construct a new Consul server from the @@ -396,6 +397,7 @@ func (s *Server) setupRPC(tlsWrap tlsutil.DCWrapper) error { s.endpoints.Session = &Session{s} s.endpoints.Internal = &Internal{s} s.endpoints.ACL = &ACL{s} + s.endpoints.Coordinate = &Coordinate{s} // Register the handlers s.rpcServer.Register(s.endpoints.Status) diff --git a/consul/structs/structs.go b/consul/structs/structs.go index e884ff6b43..15597e2a39 100644 --- a/consul/structs/structs.go +++ b/consul/structs/structs.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/consul/acl" "github.com/hashicorp/go-msgpack/codec" + "github.com/hashicorp/serf/coordinate" ) var ( @@ -618,6 +619,21 @@ type ACLPolicy struct { QueryMeta } +// Coordinate stores a mapping from a node to its network coordinate +type Coordinate struct { + Node string + Coord *coordinate.Coordinate +} + +type CoordinateGetRequest struct { + Nodes []string +} + +type CoordinateUpdateRequest struct { + Node string + Coord *coordinate.Coordinate +} + // EventFireRequest is used to ask a server to fire // a Serf event. It is a bit odd, since it doesn't depend on // the catalog or leader. Any node can respond, so it's not quite