Change GET API a little bit

This commit is contained in:
Derek Chiang 2015-04-09 17:57:49 -04:00 committed by James Phillips
parent a9ea503c69
commit b87f122a5b
2 changed files with 6 additions and 17 deletions

View File

@ -13,22 +13,17 @@ type Coordinate struct {
// If the node is in the same datacenter, then the LAN coordinate of the node is
// returned. If the node is in a remote DC, then the WAN coordinate of the node
// is returned.
func (c *Coordinate) Get(args *structs.CoordinateGetRequest, reply *structs.Coordinate) error {
func (c *Coordinate) Get(args *structs.NodeSpecificRequest, reply *structs.Coordinate) error {
if done, err := c.srv.forward("Coordinate.Get", args, args, reply); done {
return err
}
if args.OriginDC == c.srv.config.Datacenter {
state := c.srv.fsm.State()
_, coord, err := state.CoordinateGet(args.Node)
if err != nil {
return err
}
*reply = *coord
} else {
reply.Node = args.Node
reply.Coord = c.srv.serfWAN.GetCoordinate()
state := c.srv.fsm.State()
_, coord, err := state.CoordinateGet(args.Node)
if err != nil {
return err
}
*reply = *coord
return nil
}

View File

@ -626,12 +626,6 @@ type Coordinate struct {
Coord *coordinate.Coordinate
}
// CoordinateGetRequest is used to request the network coordinate of a given node
type CoordinateGetRequest struct {
NodeSpecificRequest
OriginDC string
}
type CoordinateOp string
const (