mirror of https://github.com/status-im/consul.git
consul: Adding KVS RPC endpoint
This commit is contained in:
parent
6ca5c7c49d
commit
47ad40a925
|
@ -0,0 +1,8 @@
|
||||||
|
package consul
|
||||||
|
|
||||||
|
import ()
|
||||||
|
|
||||||
|
// KVS endpoint is used to manipulate the Key-Value store
|
||||||
|
type KVS struct {
|
||||||
|
srv *Server
|
||||||
|
}
|
|
@ -101,6 +101,7 @@ type endpoints struct {
|
||||||
Health *Health
|
Health *Health
|
||||||
Raft *Raft
|
Raft *Raft
|
||||||
Status *Status
|
Status *Status
|
||||||
|
KVS *KVS
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServer is used to construct a new Consul server from the
|
// 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.Raft = &Raft{s}
|
||||||
s.endpoints.Catalog = &Catalog{s}
|
s.endpoints.Catalog = &Catalog{s}
|
||||||
s.endpoints.Health = &Health{s}
|
s.endpoints.Health = &Health{s}
|
||||||
|
s.endpoints.KVS = &KVS{s}
|
||||||
|
|
||||||
// Register the handlers
|
// Register the handlers
|
||||||
s.rpcServer.Register(s.endpoints.Status)
|
s.rpcServer.Register(s.endpoints.Status)
|
||||||
s.rpcServer.Register(s.endpoints.Raft)
|
s.rpcServer.Register(s.endpoints.Raft)
|
||||||
s.rpcServer.Register(s.endpoints.Catalog)
|
s.rpcServer.Register(s.endpoints.Catalog)
|
||||||
s.rpcServer.Register(s.endpoints.Health)
|
s.rpcServer.Register(s.endpoints.Health)
|
||||||
|
s.rpcServer.Register(s.endpoints.KVS)
|
||||||
|
|
||||||
list, err := net.ListenTCP("tcp", s.config.RPCAddr)
|
list, err := net.ListenTCP("tcp", s.config.RPCAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue