consul: Adding KVS RPC endpoint

This commit is contained in:
Armon Dadgar 2014-03-31 14:15:49 -07:00
parent 6ca5c7c49d
commit 47ad40a925
2 changed files with 11 additions and 0 deletions

8
consul/kvs_endpoint.go Normal file
View File

@ -0,0 +1,8 @@
package consul
import ()
// KVS endpoint is used to manipulate the Key-Value store
type KVS struct {
srv *Server
}

View File

@ -101,6 +101,7 @@ type endpoints struct {
Health *Health
Raft *Raft
Status *Status
KVS *KVS
}
// NewServer is used to construct a new Consul server from the
@ -276,12 +277,14 @@ func (s *Server) setupRPC() error {
s.endpoints.Raft = &Raft{s}
s.endpoints.Catalog = &Catalog{s}
s.endpoints.Health = &Health{s}
s.endpoints.KVS = &KVS{s}
// Register the handlers
s.rpcServer.Register(s.endpoints.Status)
s.rpcServer.Register(s.endpoints.Raft)
s.rpcServer.Register(s.endpoints.Catalog)
s.rpcServer.Register(s.endpoints.Health)
s.rpcServer.Register(s.endpoints.KVS)
list, err := net.ListenTCP("tcp", s.config.RPCAddr)
if err != nil {