pub struct LockBuilder { /* private fields */ }Expand description
Used to create a Lock with advanced configuration.
Implementations§
Source§impl LockBuilder
impl LockBuilder
Sourcepub fn new<L: IntoLockID>(lock_id: L) -> Self
pub fn new<L: IntoLockID>(lock_id: L) -> Self
Construct a new LockBuilder with the given Lock ID.
Sourcepub fn client_id(self, client_id: Vec<u8>) -> Self
pub fn client_id(self, client_id: Vec<u8>) -> Self
Specify the data used to uniquely identify this client as distinct from other clients.
It is recommended that you set this value, in order to use the same Client ID across restarts of the same client. If you do not, then a restart will prevent the client from grabbing the lock until the lock expires. If this value is not set, a random Client ID will be used when the Lock is built (using LockBuilder::build).
Client IDs should be relatively small, and must be fewer than 64 bytes long.
Sourcepub fn lifetime_seconds(self, seconds: u16) -> Self
pub fn lifetime_seconds(self, seconds: u16) -> Self
Specify how long the lock will stay locked before expiring.
Refreshing the lock (re-locking with the same client who already holds the lock) will extend the lifetime by this amount. If this value is not set, an arbitrary lifetime will be chosen.