Documentation ¶
Index ¶
Constants ¶
View Source
const ( //Dockyard Data Index GLOBAL_REPOSITORY_INDEX = "GLOBAL_REPOSITORY_INDEX" GLOBAL_IMAGE_INDEX = "GLOBAL_IMAGE_INDEX" GLOBAL_TARSUM_INDEX = "GLOBAL_TARSUM_INDEX" GLOBAL_TAG_INDEX = "GLOBAL_TAG_INDEX" GLOBAL_COMPOSE_INDEX = "GLOBAL_COMPOSE_INDEX" //Sail Data Index GLOBAL_USER_INDEX = "GLOBAL_USER_INDEX" GLOBAL_ORGANIZATION_INDEX = "GLOBAL_ORGANIZATION_INDEX" GLOBAL_TEAM_INDEX = "GLOBAL_TEAM_INDEX" //Wharf Data Index GLOBAL_ADMIN_INDEX = "GLOBAL_ADMIN_INDEX" GLOBAL_LOG_INDEX = "GLOBAL_LOG_INDEX" )
Variables ¶
View Source
var (
Client *redis.Client
)
Functions ¶
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
func NewLock ¶
func NewLock(client *redis.Client, key string, opts *LockOptions) *Lock
NewLock creates a new distributed lock on key
func ObtainLock ¶
func ObtainLock(client *redis.Client, key string, opts *LockOptions) (*Lock, error)
ObtainLock is a shortcut for NewLock().Lock()
type LockOptions ¶
type LockOptions struct { // The maximum duration to lock a key for // Default: 5s LockTimeout time.Duration // The maximum amount of time you are willing to wait to obtain that lock // Default: 0 = do not wait WaitTimeout time.Duration // In case WaitTimeout is activated, this it the amount of time you are willing // to wait between retries. // Default: 100ms, must be at least 10ms WaitRetry time.Duration }
Click to show internal directories.
Click to hide internal directories.