type ExclusivePool … // NewExclusivePool initializes and returns a new ExclusivePool object. func NewExclusivePool() *ExclusivePool { … } // CheckIn checks in an instance to the pool and hangs while instance // with same identity is using the lock. func (p *ExclusivePool) CheckIn(identity string) { … } // CheckOut checks out an instance from the pool and releases the lock to let other instances with same identity to grab the lock. func (p *ExclusivePool) CheckOut(identity string) { … } type StatusTable … // NewStatusTable initializes and returns a new StatusTable object. func NewStatusTable() *StatusTable { … } // Start sets value of given name to true in the pool. func (p *StatusTable) Start(name string) { … } // Stop sets value of given name to false in the pool. func (p *StatusTable) Stop(name string) { … } // IsRunning checks if value of given name is set to true in the pool. func (p *StatusTable) IsRunning(name string) bool { … } type UniqueQueue … // NewUniqueQueue initializes and returns a new UniqueQueue object. func NewUniqueQueue(queueLength int) *UniqueQueue { … } // Queue returns channel of queue for retrieving instances. func (q *UniqueQueue) Queue() <-chan string { … } // Exist returns true if there is an instance with given indentity // exists in the queue. func (q *UniqueQueue) Exist(id string) bool { … } // AddFunc adds new instance to the queue with a custom runnable function, // the queue is blocked until the function exits. func (q *UniqueQueue) AddFunc(id string, fn func()) { … } // Add adds new instance to the queue. func (q *UniqueQueue) Add(id string) { … } // Remove removes instance from the queue. func (q *UniqueQueue) Remove(id string) { … }