func (l *dynamodbLock) Lock(stopChan chan struct{}) (<-chan struct{}, error) {
	lockHeld := make(chan struct{})
	success, err := l.tryLock(lockHeld, stopChan)
	if err != nil {
		return nil, err
	}
	if success {
		return lockHeld, nil
	}
	if !l.tryLockPollingEnable {
		return nil, ErrLockAcquireFailed
	}
	ticker := time.NewTicker(DefaultLockBackOff)
	for {
		select {
		case <-ticker.C:
			success, err := l.tryLock(lockHeld, stopChan)
			if err != nil {
				return nil, err
			}
			if success {
				return lockHeld, nil
			}
		case <-stopChan:
			return nil, ErrLockAcquireCancelled
		}
	}
}
Lock attempt to lock the DynamoDB record, this will BLOCK and retry at a rate of once every 3 seconds
package dynalock
import (
	"context"
	"time"
	"github.com/aws/aws-sdk-go/service/dynamodb"
)
var (
	DefaultLockBackOff = 3 * time.Second
)
type dynamodbLock struct {
	ddb                  *Dynalock
	last                 *KVPair
	renewCh              chan struct{}
	renewEnable          bool
	tryLockPollingEnable bool
	unlockCh             chan struct{}
	key   string
	value *dynamodb.AttributeValue
	ttl   time.Duration
}