Documentation ¶
Index ¶
Constants ¶
View Source
const Prefix = "GoInterLock"
Variables ¶
This section is empty.
Functions ¶
func DynamoDbUnlockMarshal ¶
func DynamoDbUnlockMarshal(key string) map[string]*dynamodb.AttributeValue
Types ¶
type DynamoDbLocker ¶ added in v1.1.1
type DynamoDbLocker struct { //leave empty to get from ~/.aws/credentials, (if AwsDynamoDbEndpoint not provided) AwsDynamoDbRegion string //leave empty to get from ~/.aws/credentials AwsDynamoDbEndpoint string //leave empty to get from ~/.aws/credentials, StaticCredentials (if AwsDynamoDbEndpoint not provided) AwsDynamoDbAccessKeyID string //leave empty to get from ~/.aws/credentials, StaticCredentials (if AwsDynamoDbEndpoint not provided) AwsDynamoDbSecretAccessKey string //leave empty to get from ~/.aws/credentials, StaticCredentials (if AwsDynamoDbEndpoint not provided) AwsDynamoDbSessionToken string // contains filtered or unexported fields }
func (*DynamoDbLocker) SetClient ¶ added in v1.1.1
func (d *DynamoDbLocker) SetClient() error
type GoInterval ¶
type GoInterval struct { //Name: is a unique job/task name, this is needed for distribution lock, this value enables the distribution mode. for local uses you don't need to set this value Name string // Arg: the func that need to be call in every period Arg func() // Interval: Timer Interval Interval time.Duration LockVendor LockVendor // RedisConnector : in case your app has redis connection configured already RedisConnector *redis.Client // RedisHost Redis Host the default value "localhost:6379" RedisHost string // RedisPassword: Redis Password (AUTH), It can be blank if Redis has no authentication req RedisPassword string // 0 , It's from 0 to 15 (Not for redis cluster) RedisDB string //leave empty to get from ~/.aws/credentials, (if AwsDynamoDbEndpoint not provided) AwsDynamoDbRegion string //leave empty to get from ~/.aws/credentials AwsDynamoDbEndpoint string //leave empty to get from ~/.aws/credentials, StaticCredentials (if AwsDynamoDbEndpoint not provided) AwsDynamoDbAccessKeyID string //leave empty to get from ~/.aws/credentials, StaticCredentials (if AwsDynamoDbEndpoint not provided) AwsDynamoDbSecretAccessKey string //leave empty to get from ~/.aws/credentials, StaticCredentials (if AwsDynamoDbEndpoint not provided) AwsDynamoDbSessionToken string // contains filtered or unexported fields }
func (*GoInterval) Run ¶
func (t *GoInterval) Run(ctx context.Context) error
Run to start the interval timer
func (*GoInterval) UnLock ¶
func (t *GoInterval) UnLock(ctx context.Context)
type LockVendor ¶
type LockVendor int32
const ( SingleApp LockVendor = 0 // no distributed lock RedisLock LockVendor = 1 AwsDynamoDbLock LockVendor = 2 )
type RedisLocker ¶ added in v1.1.1
type RedisLocker struct { // Name: is a unique job/task name, this is needed for distribution lock, this value enables the distribution mode. for local uses you don't need to set this value Name string // RedisHost Redis Host the default value "localhost:6379" RedisHost string // RedisPassword: Redis Password (AUTH), It can be blank if Redis has no authentication req RedisPassword string // 0 , It's from 0 to 15 (Not for redis cluster) RedisDB string // contains filtered or unexported fields }
func (*RedisLocker) SetClient ¶ added in v1.1.1
func (r *RedisLocker) SetClient() error
Click to show internal directories.
Click to hide internal directories.