grpcproxy: return interface
parent
3a5e418ff9
commit
5271cf0160
|
@ -27,7 +27,7 @@ type kvProxy struct {
|
|||
cache cache.Cache
|
||||
}
|
||||
|
||||
func NewKvProxy(c *clientv3.Client) *kvProxy {
|
||||
func NewKvProxy(c *clientv3.Client) pb.KVServer {
|
||||
return &kvProxy{
|
||||
client: c,
|
||||
cache: cache.NewCache(cache.DefaultMaxEntries),
|
||||
|
@ -102,10 +102,6 @@ func (p *kvProxy) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.Com
|
|||
return (*pb.CompactionResponse)(resp), err
|
||||
}
|
||||
|
||||
func (p *kvProxy) Close() error {
|
||||
return p.client.Close()
|
||||
}
|
||||
|
||||
func requestOpToOp(union *pb.RequestOp) clientv3.Op {
|
||||
switch tv := union.Request.(type) {
|
||||
case *pb.RequestOp_RequestRange:
|
||||
|
|
|
@ -50,10 +50,11 @@ func TestKVProxyRange(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("err = %v, want nil", err)
|
||||
}
|
||||
client.Close()
|
||||
}
|
||||
|
||||
type kvproxyTestServer struct {
|
||||
kp *kvProxy
|
||||
kp pb.KVServer
|
||||
server *grpc.Server
|
||||
l net.Listener
|
||||
}
|
||||
|
@ -61,7 +62,6 @@ type kvproxyTestServer struct {
|
|||
func (kts *kvproxyTestServer) close() {
|
||||
kts.server.Stop()
|
||||
kts.l.Close()
|
||||
kts.kp.Close()
|
||||
}
|
||||
|
||||
func newKVProxyServer(endpoints []string, t *testing.T) *kvproxyTestServer {
|
||||
|
|
|
@ -25,7 +25,7 @@ type leaseProxy struct {
|
|||
client *clientv3.Client
|
||||
}
|
||||
|
||||
func NewLeaseProxy(c *clientv3.Client) *leaseProxy {
|
||||
func NewLeaseProxy(c *clientv3.Client) pb.LeaseServer {
|
||||
return &leaseProxy{
|
||||
client: c,
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ type watchProxy struct {
|
|||
nextStreamID int64
|
||||
}
|
||||
|
||||
func NewWatchProxy(c *clientv3.Client) *watchProxy {
|
||||
func NewWatchProxy(c *clientv3.Client) pb.WatchServer {
|
||||
return &watchProxy{
|
||||
c: c,
|
||||
wgs: watchergroups{
|
||||
|
|
Loading…
Reference in New Issue