pub struct LockRequest<'a> {
pub key: &'a str,
pub session_id: &'a str,
pub namespace: &'a str,
pub datacenter: &'a str,
pub timeout: Duration,
pub behavior: LockExpirationBehavior,
pub lock_delay: Duration,
}Expand description
Represents a request to create a lock .
Fields§
§key: &'a strThe key to use for locking.
session_id: &'a strThe name of the session to use.
namespace: &'a strSpecifies the namespace to use. If not provided, the namespace will be inferred from the request’s ACL token, or will default to the default namespace. This is specified as part of the URL as a query parameter. Added in Consul 1.7.0.
datacenter: &'a strSpecifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter.
timeout: DurationSpecifies the duration of a session (between 10s and 86400s). If provided, the session is invalidated if it is not renewed before the TTL expires. The lowest practical TTL should be used to keep the number of managed sessions low. When locks are forcibly expired, such as when following the leader election pattern in an application, sessions may not be reaped for up to double this TTL, so long TTL values (> 1 hour) should be avoided. Defaults to 10 seconds.
behavior: LockExpirationBehaviorControls the behavior to take when a session is invalidated. See also LockExpirationBehavior
lock_delay: DurationSpecifies the duration for the lock delay. Defaults to 1 second.
Implementations§
Source§impl<'a> LockRequest<'a>
impl<'a> LockRequest<'a>
Sourcepub fn builder() -> LockRequestBuilder<'a>
pub fn builder() -> LockRequestBuilder<'a>
Create an instance of LockRequest using the builder syntax
Trait Implementations§
Source§impl<'a> Clone for LockRequest<'a>
impl<'a> Clone for LockRequest<'a>
Source§fn clone(&self) -> LockRequest<'a>
fn clone(&self) -> LockRequest<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more