Struct dynalock::DistLock [] [src]

pub struct DistLock<Driver> { /* fields omitted */ }

The distributed lock structure that holds all the internal lock state and information.

This is the entry point to this library and should be used to hold a lock on a shared resource.

Examples

use std::time::Duration;
use dynalock::DistLock;

let mut dlock = DistLock::new(
    "some driver",
    Duration::from_secs(10)
    );

Methods

impl<Driver> DistLock<Driver>
[src]

[src]

Initialize a new DistLock structure and return it.

This static method accepts a Driver and std::time::Duration as parameters. The duration parameter is used to describe the time for which the lock should be held.

[src]

Return a mutable reference to the underlying driver field.

[src]

Return the configured lease duration for the lock.

Trait Implementations

impl<P, D> Locking for DistLock<DynamoDbDriver<P, D>> where
    P: ProvideAwsCredentials + 'static,
    D: DispatchSignedRequest + 'static, 
[src]

Associated type for the acquire_lock method input type.

Associated type for the refresh_lock method input type.

Associated type for the release_lock method input type.

[src]

Try to acquire a lock on a shared resource. Read more

[src]

Try to refresh the current lock data structure. Read more

[src]

This optional method is only useful in rare situations and highly depends on the provider's implementation and primitives supported. Providers should implement this method to release the lock by clearing the fence token. Read more

[src]

When acquire_lock is successful it returns an std::time::Instant which is used to track the time from when the lease was issued. This method is used to safely calculate the time or duration left since acquire_lock was called. If the return value is None this means that the lock lease has expired and you must stop mutating the shared resource immediately. Read more

impl<Driver: Debug> Debug for DistLock<Driver>
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<Driver> Send for DistLock<Driver> where
    Driver: Send

impl<Driver> Sync for DistLock<Driver> where
    Driver: Sync