3 releases

0.4.3 Mar 1, 2023
0.4.2 Jan 2, 2023
0.4.1 May 16, 2022

#235 in Database interfaces

Download history 199/week @ 2023-01-27 95/week @ 2023-02-03 266/week @ 2023-02-10 15/week @ 2023-02-17 106/week @ 2023-02-24 65/week @ 2023-03-03 92/week @ 2023-03-10 149/week @ 2023-03-17 207/week @ 2023-03-24 378/week @ 2023-03-31 207/week @ 2023-04-07 327/week @ 2023-04-14 665/week @ 2023-04-21 264/week @ 2023-04-28 306/week @ 2023-05-05 225/week @ 2023-05-12

1,543 downloads per month
Used in deltalake

Apache-2.0

35KB
566 lines

dynamodb lock

Dynamodb based distributed lock implemented in pure Rust. The design is largely inspired by amazon-dynamodb-lock-client.

It is used by the delta-rs project to implement PUT if absence semantic for concurrent S3 writes. It is considered production ready and battle tested through the kafka-delta-ingest project.

Usage

let dynamodb_client = rusoto_dynamodb::DynamoDbClient::new(rusoto_core::Region::default());
let lock_client = dynamodb_lock::DynamoDbLockClient::new(
    dynamodb_client,
    dynamodb_lock::DynamoDbOptions::default(),
);

let lock_data = "Moe";
let lock = lock_client.try_acquire_lock(lock_data).await?.unwrap();

if lock.acquired_expired_lock {
    // error handling when acquired an expired lock
}

// do stuff in the critical region

lock_client.release_lock(&lock).await?;

For real world example, see https://github.com/delta-io/delta-rs/blob/main/rust/src/storage/s3/mod.rs.

Dependencies

~9–44MB
~755K SLoC