Start adding stuff

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

View File

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

View File

@ -151,6 +151,7 @@ type endpoints struct {
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