mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdmain: support key leasing in grpcproxy
This commit is contained in:
parent
468078ffcd
commit
9be715bb66
@ -26,6 +26,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
|
"github.com/coreos/etcd/clientv3/leasing"
|
||||||
"github.com/coreos/etcd/clientv3/namespace"
|
"github.com/coreos/etcd/clientv3/namespace"
|
||||||
"github.com/coreos/etcd/clientv3/ordering"
|
"github.com/coreos/etcd/clientv3/ordering"
|
||||||
"github.com/coreos/etcd/etcdserver/api/etcdhttp"
|
"github.com/coreos/etcd/etcdserver/api/etcdhttp"
|
||||||
@ -70,6 +71,7 @@ var (
|
|||||||
grpcProxyResolverTTL int
|
grpcProxyResolverTTL int
|
||||||
|
|
||||||
grpcProxyNamespace string
|
grpcProxyNamespace string
|
||||||
|
grpcProxyLeasing string
|
||||||
|
|
||||||
grpcProxyEnablePprof bool
|
grpcProxyEnablePprof bool
|
||||||
grpcProxyEnableOrdering bool
|
grpcProxyEnableOrdering bool
|
||||||
@ -124,7 +126,7 @@ func newGRPCProxyStartCommand() *cobra.Command {
|
|||||||
|
|
||||||
// experimental flags
|
// experimental flags
|
||||||
cmd.Flags().BoolVar(&grpcProxyEnableOrdering, "experimental-serializable-ordering", false, "Ensure serializable reads have monotonically increasing store revisions across endpoints.")
|
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
|
return &cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,6 +284,10 @@ func newGRPCProxyServer(client *clientv3.Client) *grpc.Server {
|
|||||||
client.Lease = namespace.NewLease(client.Lease, grpcProxyNamespace)
|
client.Lease = namespace.NewLease(client.Lease, grpcProxyNamespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(grpcProxyLeasing) > 0 {
|
||||||
|
client.KV, _ = leasing.NewKV(client, grpcProxyLeasing)
|
||||||
|
}
|
||||||
|
|
||||||
kvp, _ := grpcproxy.NewKvProxy(client)
|
kvp, _ := grpcproxy.NewKvProxy(client)
|
||||||
watchp, _ := grpcproxy.NewWatchProxy(client)
|
watchp, _ := grpcproxy.NewWatchProxy(client)
|
||||||
if grpcProxyResolverPrefix != "" {
|
if grpcProxyResolverPrefix != "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user