Documentation
¶
Overview ¶
Package workitemLock provides a locking mechanism for workitems
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var LockTypeName = map[int]string{
0: "memory",
1: "mongodb",
}
View Source
var LockTypeValue = map[string]WorkItemLockType{ LockTypeName[0]: LOCK_MEMORY, LockTypeName[1]: LOCK_MONGODB, }
Functions ¶
This section is empty.
Types ¶
type MemoryWorkItemLock ¶
type MemoryWorkItemLock struct {
// contains filtered or unexported fields
}
MemoryWorkItemLock is a simple in-memory implementation of the WorkItemLock interface. Cannot be used for horizontal scaling.
func NewMemoryWorkItemLock ¶
func NewMemoryWorkItemLock() *MemoryWorkItemLock
func (*MemoryWorkItemLock) StartHousekeeping ¶
func (w *MemoryWorkItemLock) StartHousekeeping()
type MongoWorkItemLock ¶
type MongoWorkItemLock struct {
// contains filtered or unexported fields
}
MongoWorkItemLock is a workitem lock implementation based on MongoDB
func NewMongoWorkItemLock ¶
func NewMongoWorkItemLock(lockName, lockID string, db *mongo.Database) *MongoWorkItemLock
func (*MongoWorkItemLock) StartHousekeeping ¶
func (w *MongoWorkItemLock) StartHousekeeping()
StartHousekeeping starts a housekeeping goroutine which removes expired locks
type WorkItemLock ¶
type WorkItemLock interface { Lock(ctx context.Context, workitemID string, ttl *time.Duration) error Unlock(ctx context.Context, workitemID string) error }
WorkItemLock allows the unwindia services to lock workitems to prevent concurrent processing
type WorkItemLockEntry ¶
type WorkItemLockType ¶
type WorkItemLockType int
const ( LOCK_MEMORY WorkItemLockType = iota LOCK_MONGODB )
func (WorkItemLockType) String ¶
func (p WorkItemLockType) String() string
func (*WorkItemLockType) Unmarshal ¶
func (p *WorkItemLockType) Unmarshal(data string) error
func (*WorkItemLockType) UnmarshalJSON ¶
func (p *WorkItemLockType) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals b into PulsarAuth.
func (*WorkItemLockType) UnmarshalText ¶
func (p *WorkItemLockType) UnmarshalText(text []byte) error
Click to show internal directories.
Click to hide internal directories.