Instead of using a software like Zoopkeeper or Consul, my team is considering using Cockroach to implement a distributed lease. The lease will be distributed between two processes, each in one datacenter. One argument is that we already have Cockroach deployed and if the algorithm is simple, it could be simpler than deploying and configuring this software. Another reason is that the process having the lock need to access cockroach so if we bind the lease to cockroach, a process could acquire the lease only when cockroach is available for him.
Does it sound like a reasonable idea to you? If yes, what would be the best primitives in cockroach to implement such a lease or such a lock?