Documentation ¶
Index ¶
- Constants
- Variables
- func CreateLockTable(tableName string, readCapacityUnits int, writeCapacityUnits int, ...) error
- func CreateLockTableIfNecessary(tableName string, client *dynamodb.DynamoDB, ...) error
- func DeleteTable(tableName string, client *dynamodb.DynamoDB) error
- func New(conf map[string]string) (locks.Lock, error)
- type AcquireLockRetriesExceeded
- type AttributeMissing
- type CountingSemaphore
- type DynamoDbLock
- type InvalidDateFormat
- type InvalidMaxLockRetriesValue
- type ItemDoesNotExist
- type TableActiveRetriesExceeded
- type TableDoesNotExist
Constants ¶
const ATTR_CREATION_DATE = "CreationDate"
const ATTR_IP = "Ip"
const ATTR_STATE_FILE_ID = "StateFileId"
The names of attributes we use in the DynamoDB lock table
const ATTR_USERNAME = "Username"
const DEFAULT_AWS_REGION = "us-east-1"
const DEFAULT_MAX_RETRIES_WAITING_FOR_LOCK = 360
Default is to retry for up to 1 hour
const DEFAULT_READ_CAPACITY_UNITS = 1
const DEFAULT_TABLE_NAME = "terragrunt_locks"
const DEFAULT_TEST_REGION = "us-east-1"
For simplicity, do all testing in the us-east-1 region
const DEFAULT_WRITE_CAPACITY_UNITS = 1
const MAX_RETRIES_WAITING_FOR_TABLE_TO_BE_ACTIVE = 30
Default is to retry for up to 5 minutes
const SLEEP_BETWEEN_TABLE_LOCK_ACQUIRE_ATTEMPTS = 10 * time.Second
const SLEEP_BETWEEN_TABLE_STATUS_CHECKS = 10 * time.Second
Variables ¶
var StateFileIdMissing = fmt.Errorf("state_file_id cannot be empty")
Functions ¶
func CreateLockTable ¶ added in v0.7.4
func CreateLockTable(tableName string, readCapacityUnits int, writeCapacityUnits int, client *dynamodb.DynamoDB, terragruntOptions *options.TerragruntOptions) error
Create a lock table in DynamoDB and wait until it is in "active" state. If the table already exists, merely wait until it is in "active" state.
func CreateLockTableIfNecessary ¶ added in v0.7.4
func CreateLockTableIfNecessary(tableName string, client *dynamodb.DynamoDB, terragruntOptions *options.TerragruntOptions) error
Create the lock table in DynamoDB if it doesn't already exist
func DeleteTable ¶ added in v0.7.4
Delete the given table in DynamoDB
Types ¶
type AcquireLockRetriesExceeded ¶
func (AcquireLockRetriesExceeded) Error ¶
func (err AcquireLockRetriesExceeded) Error() string
type AttributeMissing ¶
type AttributeMissing struct {
AttributeName string
}
func (AttributeMissing) Error ¶
func (err AttributeMissing) Error() string
type CountingSemaphore ¶ added in v0.7.4
type CountingSemaphore chan empty
func NewCountingSemaphore ¶ added in v0.7.4
func NewCountingSemaphore(size int) CountingSemaphore
A bare-bones counting semaphore implementation based on: http://www.golangpatterns.info/concurrency/semaphores
func (CountingSemaphore) Acquire ¶ added in v0.7.4
func (semaphore CountingSemaphore) Acquire()
func (CountingSemaphore) Release ¶ added in v0.7.4
func (semaphore CountingSemaphore) Release()
type DynamoDbLock ¶
type DynamoDbLock struct { StateFileId string AwsRegion string TableName string MaxLockRetries int }
A lock that uses AWS's DynamoDB to acquire and release locks
func (DynamoDbLock) AcquireLock ¶
func (dynamoDbLock DynamoDbLock) AcquireLock(terragruntOptions *options.TerragruntOptions) error
Acquire a lock by writing an entry to DynamoDB. If that write fails, it means someone else already has the lock, so retry until they release the lock.
func (DynamoDbLock) ReleaseLock ¶
func (dynamoDbLock DynamoDbLock) ReleaseLock(terragruntOptions *options.TerragruntOptions) error
Release a lock by deleting an entry from DynamoDB.
func (DynamoDbLock) String ¶
func (dynamoLock DynamoDbLock) String() string
Print a string representation of this lock
type InvalidDateFormat ¶
func (InvalidDateFormat) Error ¶
func (err InvalidDateFormat) Error() string
type InvalidMaxLockRetriesValue ¶
type InvalidMaxLockRetriesValue struct {
ValidationErr error
}
func (*InvalidMaxLockRetriesValue) Error ¶
func (err *InvalidMaxLockRetriesValue) Error() string
type ItemDoesNotExist ¶ added in v0.9.3
func (ItemDoesNotExist) Error ¶ added in v0.9.3
func (err ItemDoesNotExist) Error() string
type TableActiveRetriesExceeded ¶
func (TableActiveRetriesExceeded) Error ¶
func (err TableActiveRetriesExceeded) Error() string
type TableDoesNotExist ¶ added in v0.9.3
func (TableDoesNotExist) Error ¶ added in v0.9.3
func (err TableDoesNotExist) Error() string