Start adding stuff

This commit is contained in:
Derek Chiang 2015-03-28 14:52:04 -04:00 committed by James Phillips
parent 3d33525b67
commit e54c8f2ea0
3 changed files with 30 additions and 7 deletions

View file

@ -0,0 +1,5 @@
package consul
type Coordinate struct {
srv *Server
}

View file

@ -144,13 +144,14 @@ type Server struct {
// Holds the RPC endpoints // Holds the RPC endpoints
type endpoints struct { type endpoints struct {
Catalog *Catalog Catalog *Catalog
Health *Health Health *Health
Status *Status Status *Status
KVS *KVS KVS *KVS
Session *Session Session *Session
Internal *Internal Internal *Internal
ACL *ACL ACL *ACL
Coordinate *Coordinate
} }
// NewServer is used to construct a new Consul server from the // 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.Session = &Session{s}
s.endpoints.Internal = &Internal{s} s.endpoints.Internal = &Internal{s}
s.endpoints.ACL = &ACL{s} s.endpoints.ACL = &ACL{s}
s.endpoints.Coordinate = &Coordinate{s}
// Register the handlers // Register the handlers
s.rpcServer.Register(s.endpoints.Status) s.rpcServer.Register(s.endpoints.Status)

View file

@ -7,6 +7,7 @@ import (
"github.com/hashicorp/consul/acl" "github.com/hashicorp/consul/acl"
"github.com/hashicorp/go-msgpack/codec" "github.com/hashicorp/go-msgpack/codec"
"github.com/hashicorp/serf/coordinate"
) )
var ( var (
@ -618,6 +619,21 @@ type ACLPolicy struct {
QueryMeta 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 // EventFireRequest is used to ask a server to fire
// a Serf event. It is a bit odd, since it doesn't depend on // 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 // the catalog or leader. Any node can respond, so it's not quite