mirror of https://github.com/status-im/consul.git
49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
package consul
|
|
|
|
import (
|
|
"github.com/hashicorp/consul/consul/structs"
|
|
)
|
|
|
|
// Internal endpoint is used to query the miscellaneous info that
|
|
// does not necessarily fit into the other systems. It is also
|
|
// used to hold undocumented APIs that users should not rely on.
|
|
type Internal struct {
|
|
srv *Server
|
|
}
|
|
|
|
// ChecksInState is used to get all the checks in a given state
|
|
func (m *Internal) NodeInfo(args *structs.NodeSpecificRequest,
|
|
reply *structs.IndexedNodeDump) error {
|
|
if done, err := m.srv.forward("Internal.NodeInfo", args, args, reply); done {
|
|
return err
|
|
}
|
|
|
|
// Get the state specific checks
|
|
state := m.srv.fsm.State()
|
|
return m.srv.blockingRPC(&args.QueryOptions,
|
|
&reply.QueryMeta,
|
|
state.QueryTables("NodeInfo"),
|
|
func() error {
|
|
reply.Index, reply.Dump = state.NodeInfo(args.Node)
|
|
return nil
|
|
})
|
|
}
|
|
|
|
// ChecksInState is used to get all the checks in a given state
|
|
func (m *Internal) NodeDump(args *structs.DCSpecificRequest,
|
|
reply *structs.IndexedNodeDump) error {
|
|
if done, err := m.srv.forward("Internal.NodeDump", args, args, reply); done {
|
|
return err
|
|
}
|
|
|
|
// Get the state specific checks
|
|
state := m.srv.fsm.State()
|
|
return m.srv.blockingRPC(&args.QueryOptions,
|
|
&reply.QueryMeta,
|
|
state.QueryTables("NodeDump"),
|
|
func() error {
|
|
reply.Index, reply.Dump = state.NodeDump()
|
|
return nil
|
|
})
|
|
}
|