summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/nsr-server/src/etcd-api.h
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/nsr-server/src/etcd-api.h')
-rw-r--r--xlators/cluster/nsr-server/src/etcd-api.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/xlators/cluster/nsr-server/src/etcd-api.h b/xlators/cluster/nsr-server/src/etcd-api.h
index a43fc4844..66275d40d 100644
--- a/xlators/cluster/nsr-server/src/etcd-api.h
+++ b/xlators/cluster/nsr-server/src/etcd-api.h
@@ -174,3 +174,41 @@ etcd_result etcd_delete (etcd_session session, char *key);
*/
char * etcd_leader (etcd_session session);
+
+/*
+ * etcd_lock
+ *
+ * Take or renew a lock - really a lease but the etcd folks call it a lock so
+ * we'll follow suit.
+ *
+ * key
+ * The path (in the "locks" namespace) for the lock.
+ *
+ * ttl
+ * Time in seconds for the lock.
+ *
+ * index_in (optional, indicates renewal)
+ * Lock index from previous lock call.
+ *
+ * index_out (only used for initial lock)
+ * Place for the new lock index. You must free this.
+ */
+
+etcd_result etcd_lock (etcd_session session_as_void, char *key,
+ unsigned int ttl, char *index_in, char **index_out);
+
+/*
+ * etcd_unlock
+ *
+ * Release a lock (see etcd_lock regarding terminology).
+ *
+ * key
+ * The path (in the "locks" namespace) for the lock.
+ *
+ * index
+ * Lock index from previous lock call.
+ */
+
+etcd_result etcd_unlock (etcd_session session_as_void, char *key,
+ char *index);
+