Skip to content

Commit

Permalink
etcdmain: support key leasing in grpcproxy
Browse files Browse the repository at this point in the history
  • Loading branch information
visheshnp committed Aug 4, 2017
1 parent a06ca93 commit bae0d12
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion etcdmain/grpc_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"time"

"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/clientv3/leasing"
"github.com/coreos/etcd/clientv3/namespace"
"github.com/coreos/etcd/clientv3/ordering"
"github.com/coreos/etcd/etcdserver/api/etcdhttp"
Expand Down Expand Up @@ -70,6 +71,7 @@ var (
grpcProxyResolverTTL int

grpcProxyNamespace string
grpcProxyLeasing string

grpcProxyEnablePprof bool
grpcProxyEnableOrdering bool
Expand Down Expand Up @@ -124,7 +126,7 @@ func newGRPCProxyStartCommand() *cobra.Command {

// experimental flags
cmd.Flags().BoolVar(&grpcProxyEnableOrdering, "experimental-serializable-ordering", false, "Ensure serializable reads have monotonically increasing store revisions across endpoints.")

cmd.Flags().StringVar(&grpcProxyLeasing, "experimental-leasing-prefix", "", "leasing metadata prefix for disconnected linearized reads.")
return &cmd
}

Expand Down Expand Up @@ -282,6 +284,10 @@ func newGRPCProxyServer(client *clientv3.Client) *grpc.Server {
client.Lease = namespace.NewLease(client.Lease, grpcProxyNamespace)
}

if len(grpcProxyLeasing) > 0 {
client.KV, _ = leasing.NewKV(client, grpcProxyLeasing)
}

kvp, _ := grpcproxy.NewKvProxy(client)
watchp, _ := grpcproxy.NewWatchProxy(client)
if grpcProxyResolverPrefix != "" {
Expand Down

0 comments on commit bae0d12

Please sign in to comment.