Module dynalock::providers::dynamodb [] [src]

An implementation of the locking API using DynamoDB as a storage provider

This implementation fully implements the Locking trait for the DistLock<DynamoDbDriver> structure. Lock items on the DynamoDB table are composed of the following attributes:

  • Partition key field
  • Fence token field
  • Lease duration field
  • TTL field

The partition key of the table is used as an identifier of the shared resource, while the fence token is used to prevent the ABA problem. The duration attribute is used to specify the lock's duration. The TTL field is used to tell DynamoDB when to garbage-collect or remove items that has expired, that if TTL is configured on the table.

Currently the fence token is implemented by generating a UUID v4 token for every acquire_lock and release_lock operation. UUID v4 security and strength depends on the recent implementation of a reseeded version of the HC-128 CSPRNG in std::rand, as long as this invariant holds, fence token collisions are as rare as the CSPRNG period allows it to be (i.e., incredibly long period).

Structs

DynamoDbDriver

A structure to contain details of the DynamoDB lock implementation.

DynamoDbDriverInput

A structure that describes the inputs to DynamoDbDriver::new.

DynamoDbLockInput

A struct to hold input variables for the Locking trait methods inputs.

Constants

DAY_SECONDS

The number of seconds in 24 hours.