2019-08-22 05:12:46 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2021-07-02 22:06:02 +00:00
|
|
|
"go.etcd.io/etcd/api/v3/etcdserverpb"
|
2019-08-22 05:12:46 +00:00
|
|
|
"google.golang.org/grpc"
|
|
|
|
"google.golang.org/grpc/health"
|
|
|
|
healthpb "google.golang.org/grpc/health/grpc_health_v1"
|
|
|
|
)
|
|
|
|
|
|
|
|
type KVServerBridge struct {
|
|
|
|
limited *LimitedServer
|
|
|
|
}
|
|
|
|
|
2021-08-30 20:43:25 +00:00
|
|
|
func New(backend Backend, scheme string) *KVServerBridge {
|
2019-08-22 05:12:46 +00:00
|
|
|
return &KVServerBridge{
|
|
|
|
limited: &LimitedServer{
|
|
|
|
backend: backend,
|
2021-08-30 20:43:25 +00:00
|
|
|
scheme: scheme,
|
2019-08-22 05:12:46 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KVServerBridge) Register(server *grpc.Server) {
|
|
|
|
etcdserverpb.RegisterLeaseServer(server, k)
|
|
|
|
etcdserverpb.RegisterWatchServer(server, k)
|
|
|
|
etcdserverpb.RegisterKVServer(server, k)
|
2021-08-30 20:43:25 +00:00
|
|
|
etcdserverpb.RegisterClusterServer(server, k)
|
|
|
|
etcdserverpb.RegisterMaintenanceServer(server, k)
|
2019-08-22 05:12:46 +00:00
|
|
|
|
|
|
|
hsrv := health.NewServer()
|
|
|
|
hsrv.SetServingStatus("", healthpb.HealthCheckResponse_SERVING)
|
|
|
|
healthpb.RegisterHealthServer(server, hsrv)
|
|
|
|
}
|