forked from k3s-io/kine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.go
33 lines (28 loc) · 830 Bytes
/
server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package server
import (
"go.etcd.io/etcd/api/v3/etcdserverpb"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
)
type KVServerBridge struct {
limited *LimitedServer
}
func New(backend Backend, scheme string) *KVServerBridge {
return &KVServerBridge{
limited: &LimitedServer{
backend: backend,
scheme: scheme,
},
}
}
func (k *KVServerBridge) Register(server *grpc.Server) {
etcdserverpb.RegisterLeaseServer(server, k)
etcdserverpb.RegisterWatchServer(server, k)
etcdserverpb.RegisterKVServer(server, k)
etcdserverpb.RegisterClusterServer(server, k)
etcdserverpb.RegisterMaintenanceServer(server, k)
hsrv := health.NewServer()
hsrv.SetServingStatus("", healthpb.HealthCheckResponse_SERVING)
healthpb.RegisterHealthServer(server, hsrv)
}