Integrates new state store into internal endpoint.

This commit is contained in:
James Phillips 2015-10-12 20:48:50 -07:00
parent 76bdeadefb
commit a15c24f771
1 changed files with 20 additions and 8 deletions

View File

@ -22,12 +22,18 @@ func (m *Internal) NodeInfo(args *structs.NodeSpecificRequest,
}
// Get the node info
state := m.srv.fsm.State()
return m.srv.blockingRPC(&args.QueryOptions,
state := m.srv.fsm.StateNew()
return m.srv.blockingRPCNew(
&args.QueryOptions,
&reply.QueryMeta,
state.QueryTables("NodeInfo"),
state.GetQueryWatch("NodeInfo"),
func() error {
reply.Index, reply.Dump = state.NodeInfo(args.Node)
index, dump, err := state.NodeInfo(args.Node)
if err != nil {
return err
}
reply.Index, reply.Dump = index, dump
return m.srv.filterACL(args.Token, reply)
})
}
@ -40,12 +46,18 @@ func (m *Internal) NodeDump(args *structs.DCSpecificRequest,
}
// Get all the node info
state := m.srv.fsm.State()
return m.srv.blockingRPC(&args.QueryOptions,
state := m.srv.fsm.StateNew()
return m.srv.blockingRPCNew(
&args.QueryOptions,
&reply.QueryMeta,
state.QueryTables("NodeDump"),
state.GetQueryWatch("NodeDump"),
func() error {
reply.Index, reply.Dump = state.NodeDump()
index, dump, err := state.NodeDump()
if err != nil {
return err
}
reply.Index, reply.Dump = index, dump
return m.srv.filterACL(args.Token, reply)
})
}