From 28ec7a1e54ce0216263fc4277c990af8b452c768 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sun, 18 Feb 2018 18:07:59 -0500 Subject: [PATCH] etcd: scheduler: Remove etcd 3.2 specific hacks Now that we're using etcd 3.3, we can simplify our code now that our patches are in a release. --- etcd/scheduler/scheduler.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/etcd/scheduler/scheduler.go b/etcd/scheduler/scheduler.go index 944b4a68..7ac7ff83 100644 --- a/etcd/scheduler/scheduler.go +++ b/etcd/scheduler/scheduler.go @@ -28,7 +28,6 @@ import ( etcd "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/clientv3/concurrency" - pb "github.com/coreos/etcd/etcdserver/etcdserverpb" errwrap "github.com/pkg/errors" ) @@ -88,11 +87,6 @@ func (obj *Result) Shutdown() { // XXX: should we have a waitgroup to wait for it all to close? } -// TODO: use: https://github.com/coreos/etcd/pull/8488 when available -func leaseValue(key string) etcd.Cmp { - return etcd.Cmp{Key: []byte(key), Target: pb.Compare_LEASE} -} - // Schedule returns a scheduler result which can be queried with it's available // methods. This automatically causes different etcd clients sharing the same // path to discover each other and be part of the scheduled set. On close the @@ -181,7 +175,7 @@ func Schedule(client *etcd.Client, path string, hostname string, opts ...Option) data := "TODO" // XXX: no data to exchange alongside hostnames yet ifops := []etcd.Cmp{ etcd.Compare(etcd.Value(exchangePathHost), "=", data), - etcd.Compare(leaseValue(exchangePathHost), "=", int64(leaseID)), // XXX: remove int64() after 3.3.0 + etcd.Compare(etcd.LeaseValue(exchangePathHost), "=", leaseID), } elsop := etcd.OpPut(exchangePathHost, data, etcd.WithLease(leaseID))