From d045335ca08a95519792908d04d5b58dbf9b7092 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Mon, 28 Apr 2014 14:44:36 -0700 Subject: [PATCH] consul: Rename Misc RPC to Internal --- .../{misc_endpoint.go => internal_endpoint.go} | 12 ++++++------ ...ndpoint_test.go => internal_endpoint_test.go} | 8 ++++---- consul/server.go | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) rename consul/{misc_endpoint.go => internal_endpoint.go} (72%) rename consul/{misc_endpoint_test.go => internal_endpoint_test.go} (93%) diff --git a/consul/misc_endpoint.go b/consul/internal_endpoint.go similarity index 72% rename from consul/misc_endpoint.go rename to consul/internal_endpoint.go index eab8b58e1..53252e78e 100644 --- a/consul/misc_endpoint.go +++ b/consul/internal_endpoint.go @@ -4,17 +4,17 @@ import ( "github.com/hashicorp/consul/consul/structs" ) -// Misc endpoint is used to query the miscellaneous info that +// 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 Misc struct { +type Internal struct { srv *Server } // ChecksInState is used to get all the checks in a given state -func (m *Misc) NodeInfo(args *structs.NodeSpecificRequest, +func (m *Internal) NodeInfo(args *structs.NodeSpecificRequest, reply *structs.IndexedNodeDump) error { - if done, err := m.srv.forward("Misc.NodeInfo", args, args, reply); done { + if done, err := m.srv.forward("Internal.NodeInfo", args, args, reply); done { return err } @@ -30,9 +30,9 @@ func (m *Misc) NodeInfo(args *structs.NodeSpecificRequest, } // ChecksInState is used to get all the checks in a given state -func (m *Misc) NodeDump(args *structs.DCSpecificRequest, +func (m *Internal) NodeDump(args *structs.DCSpecificRequest, reply *structs.IndexedNodeDump) error { - if done, err := m.srv.forward("Misc.NodeDump", args, args, reply); done { + if done, err := m.srv.forward("Internal.NodeDump", args, args, reply); done { return err } diff --git a/consul/misc_endpoint_test.go b/consul/internal_endpoint_test.go similarity index 93% rename from consul/misc_endpoint_test.go rename to consul/internal_endpoint_test.go index 4fcc78bf9..a5ff17373 100644 --- a/consul/misc_endpoint_test.go +++ b/consul/internal_endpoint_test.go @@ -7,7 +7,7 @@ import ( "time" ) -func TestMisc_NodeInfo(t *testing.T) { +func TestInternal_NodeInfo(t *testing.T) { dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() @@ -42,7 +42,7 @@ func TestMisc_NodeInfo(t *testing.T) { Datacenter: "dc1", Node: "foo", } - if err := client.Call("Misc.NodeInfo", &req, &out2); err != nil { + if err := client.Call("Internal.NodeInfo", &req, &out2); err != nil { t.Fatalf("err: %v", err) } @@ -61,7 +61,7 @@ func TestMisc_NodeInfo(t *testing.T) { } } -func TestMisc_NodeDump(t *testing.T) { +func TestInternal_NodeDump(t *testing.T) { dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() @@ -114,7 +114,7 @@ func TestMisc_NodeDump(t *testing.T) { req := structs.DCSpecificRequest{ Datacenter: "dc1", } - if err := client.Call("Misc.NodeDump", &req, &out2); err != nil { + if err := client.Call("Internal.NodeDump", &req, &out2); err != nil { t.Fatalf("err: %v", err) } diff --git a/consul/server.go b/consul/server.go index 92a24d77f..a3b5baea2 100644 --- a/consul/server.go +++ b/consul/server.go @@ -107,12 +107,12 @@ type Server struct { // Holds the RPC endpoints type endpoints struct { - Catalog *Catalog - Health *Health - Raft *Raft - Status *Status - KVS *KVS - Misc *Misc + Catalog *Catalog + Health *Health + Raft *Raft + Status *Status + KVS *KVS + Internal *Internal } // NewServer is used to construct a new Consul server from the @@ -312,7 +312,7 @@ func (s *Server) setupRPC(tlsConfig *tls.Config) error { s.endpoints.Catalog = &Catalog{s} s.endpoints.Health = &Health{s} s.endpoints.KVS = &KVS{s} - s.endpoints.Misc = &Misc{s} + s.endpoints.Internal = &Internal{s} // Register the handlers s.rpcServer.Register(s.endpoints.Status) @@ -320,7 +320,7 @@ func (s *Server) setupRPC(tlsConfig *tls.Config) error { s.rpcServer.Register(s.endpoints.Catalog) s.rpcServer.Register(s.endpoints.Health) s.rpcServer.Register(s.endpoints.KVS) - s.rpcServer.Register(s.endpoints.Misc) + s.rpcServer.Register(s.endpoints.Internal) list, err := net.ListenTCP("tcp", s.config.RPCAddr) if err != nil {