mirror of
https://github.com/status-im/consul.git
synced 2025-02-23 02:48:19 +00:00
Minor structs cleanup
This commit is contained in:
parent
7b4f7ca6b6
commit
7a6dacd63e
@ -334,7 +334,7 @@ func TestCatalogNodeServices(t *testing.T) {
|
|||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if out.Address != "127.0.0.1" {
|
if out.Node.Address != "127.0.0.1" {
|
||||||
t.Fatalf("bad: %v", out)
|
t.Fatalf("bad: %v", out)
|
||||||
}
|
}
|
||||||
if len(out.Services) != 2 {
|
if len(out.Services) != 2 {
|
||||||
|
@ -279,7 +279,7 @@ func (s *StateStore) parseNodeServices(tx *MDBTxn, name string) *structs.NodeSer
|
|||||||
|
|
||||||
// Set the address
|
// Set the address
|
||||||
node := res[0].(*structs.Node)
|
node := res[0].(*structs.Node)
|
||||||
ns.Address = node.Address
|
ns.Node = *node
|
||||||
|
|
||||||
// Get the services
|
// Get the services
|
||||||
res, err = s.serviceTable.GetTxn(tx, "id", name)
|
res, err = s.serviceTable.GetTxn(tx, "id", name)
|
||||||
|
@ -47,6 +47,26 @@ type DeregisterRequest struct {
|
|||||||
CheckID string
|
CheckID string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ServiceSpecificRequest is used to query about a specific node
|
||||||
|
type ServiceSpecificRequest struct {
|
||||||
|
Datacenter string
|
||||||
|
ServiceName string
|
||||||
|
ServiceTag string
|
||||||
|
TagFilter bool // Controls tag filtering
|
||||||
|
}
|
||||||
|
|
||||||
|
// NodeSpecificRequest is used to request the information about a single node
|
||||||
|
type NodeSpecificRequest struct {
|
||||||
|
Datacenter string
|
||||||
|
Node string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChecksInStateRequest is used to query for nodes in a state
|
||||||
|
type ChecksInStateRequest struct {
|
||||||
|
Datacenter string
|
||||||
|
State string
|
||||||
|
}
|
||||||
|
|
||||||
// Used to return information about a node
|
// Used to return information about a node
|
||||||
type Node struct {
|
type Node struct {
|
||||||
Node string
|
Node string
|
||||||
@ -58,14 +78,6 @@ type Nodes []Node
|
|||||||
// Maps service name to available tags
|
// Maps service name to available tags
|
||||||
type Services map[string][]string
|
type Services map[string][]string
|
||||||
|
|
||||||
// ServiceSpecificRequest is used to query about a specific node
|
|
||||||
type ServiceSpecificRequest struct {
|
|
||||||
Datacenter string
|
|
||||||
ServiceName string
|
|
||||||
ServiceTag string
|
|
||||||
TagFilter bool // Controls tag filtering
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServiceNode represents a node that is part of a service
|
// ServiceNode represents a node that is part of a service
|
||||||
type ServiceNode struct {
|
type ServiceNode struct {
|
||||||
Node string
|
Node string
|
||||||
@ -77,12 +89,6 @@ type ServiceNode struct {
|
|||||||
}
|
}
|
||||||
type ServiceNodes []ServiceNode
|
type ServiceNodes []ServiceNode
|
||||||
|
|
||||||
// NodeSpecificRequest is used to request the information about a single node
|
|
||||||
type NodeSpecificRequest struct {
|
|
||||||
Datacenter string
|
|
||||||
Node string
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeService is a service provided by a node
|
// NodeService is a service provided by a node
|
||||||
type NodeService struct {
|
type NodeService struct {
|
||||||
ID string
|
ID string
|
||||||
@ -91,7 +97,7 @@ type NodeService struct {
|
|||||||
Port int
|
Port int
|
||||||
}
|
}
|
||||||
type NodeServices struct {
|
type NodeServices struct {
|
||||||
Address string
|
Node Node
|
||||||
Services map[string]*NodeService
|
Services map[string]*NodeService
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,10 +113,12 @@ type HealthCheck struct {
|
|||||||
}
|
}
|
||||||
type HealthChecks []*HealthCheck
|
type HealthChecks []*HealthCheck
|
||||||
|
|
||||||
// ChecksInStateRequest is used to query for nodes in a state
|
// NodeServiceStatus is used to provide the node, it's service
|
||||||
type ChecksInStateRequest struct {
|
// definition, as well as a HealthCheck that is associated
|
||||||
Datacenter string
|
type NodeServiceStatus struct {
|
||||||
State string
|
Node Node
|
||||||
|
Service NodeService
|
||||||
|
Check HealthCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode is used to decode a MsgPack encoded object
|
// Decode is used to decode a MsgPack encoded object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user