Documentation ¶
Index ¶
Constants ¶
View Source
const ( LockCollection = "locks" FieldID = "id" FieldOwner = "owner" FieldResource = "resource" FieldAcquiredTime = "acquiredTime" FieldUpdatedAt = "updatedAt" FieldExpiry = "expiry" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Lock ¶
type LockOption ¶
type LockOption interface {
Apply(options *LockOptions)
}
type LockOptions ¶
type MockedLocker ¶
func (*MockedLocker) Lock ¶
func (m *MockedLocker) Lock(ctx context.Context, resource string, options ...LockOption) (*Lock, error)
CreateFailedReloadRecord mock CreateFailedReloadRecord in ReloadService
type MongoDBLocker ¶
type MongoDBLocker struct {
// contains filtered or unexported fields
}
func NewMongoDBLocker ¶
func NewMongoDBLocker(db *mongo.Database) *MongoDBLocker
func (*MongoDBLocker) Lock ¶
func (locker *MongoDBLocker) Lock(ctx context.Context, resource string, options ...LockOption) (*Lock, error)
type WithExpiry ¶
func (WithExpiry) Apply ¶
func (expiry WithExpiry) Apply(options *LockOptions)
type WithOwner ¶
type WithOwner string
func (WithOwner) Apply ¶
func (option WithOwner) Apply(options *LockOptions)
type WithRenewExpiry ¶
func (WithRenewExpiry) Apply ¶
func (expiry WithRenewExpiry) Apply(options *LockOptions)
type WithRetry ¶ added in v1.0.1
type WithRetry RetryInterval
func (WithRetry) Apply ¶ added in v1.0.1
func (option WithRetry) Apply(options *LockOptions)
Click to show internal directories.
Click to hide internal directories.