Function tokio_etcd_lock::acquire_lease
source · pub async fn acquire_lease(
client: &mut Client,
ttl: i64
) -> Result<Lease, Error>
Expand description
Acquire an etcd Lease
that is continually kept-alive.
A lease can be used to request a lock from the etcd server that
will be purged if the client does not keep the lock alive.
The returned Lease
object will spawn
a task that will
ping the server with a keep-alive request every ttl / 2
seconds.
Example
let mut lease = tokio_etcd_lock::acquire_lease(&mut client, 10).await?;