mirror of https://github.com/status-im/consul.git
Change GET API a little bit
This commit is contained in:
parent
a9ea503c69
commit
b87f122a5b
|
@ -13,22 +13,17 @@ type Coordinate struct {
|
||||||
// If the node is in the same datacenter, then the LAN coordinate of the node is
|
// 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
|
// returned. If the node is in a remote DC, then the WAN coordinate of the node
|
||||||
// is returned.
|
// 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 {
|
if done, err := c.srv.forward("Coordinate.Get", args, args, reply); done {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.OriginDC == c.srv.config.Datacenter {
|
state := c.srv.fsm.State()
|
||||||
state := c.srv.fsm.State()
|
_, coord, err := state.CoordinateGet(args.Node)
|
||||||
_, coord, err := state.CoordinateGet(args.Node)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
*reply = *coord
|
|
||||||
} else {
|
|
||||||
reply.Node = args.Node
|
|
||||||
reply.Coord = c.srv.serfWAN.GetCoordinate()
|
|
||||||
}
|
}
|
||||||
|
*reply = *coord
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -626,12 +626,6 @@ type Coordinate struct {
|
||||||
Coord *coordinate.Coordinate
|
Coord *coordinate.Coordinate
|
||||||
}
|
}
|
||||||
|
|
||||||
// CoordinateGetRequest is used to request the network coordinate of a given node
|
|
||||||
type CoordinateGetRequest struct {
|
|
||||||
NodeSpecificRequest
|
|
||||||
OriginDC string
|
|
||||||
}
|
|
||||||
|
|
||||||
type CoordinateOp string
|
type CoordinateOp string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
Loading…
Reference in New Issue