Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CLOSED = errors.New("the semaphore has been closed")
var QFULL = errors.New("the channel is full, nothing can be inserted until consumers catch up")
var UNIQUEUE_CLOSED = errors.New("this uniqueue is closed")
Functions ¶
Types ¶
type DedupWorkerPool ¶
type DedupWorkerPool struct {
// contains filtered or unexported fields
}
This worker pool doesn't block on submit or repeat operations over the time period specified by the passed uniqueue
func NewDedupWorkerPool ¶
func NewDedupWorkerPool(workers int, uniq *UniQueue, se SideEffectFn, parentCtx context.Context, qcanc context.CancelFunc) *DedupWorkerPool
func (*DedupWorkerPool) Close ¶
func (w *DedupWorkerPool) Close()
func (*DedupWorkerPool) Submit ¶
func (w *DedupWorkerPool) Submit(work string) error
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(maxparallel, maxpersecond int, ctx context.Context) *RateLimiter
func (*RateLimiter) Acquire ¶
func (r *RateLimiter) Acquire()
func (*RateLimiter) Release ¶
func (r *RateLimiter) Release()
type SideEffectFn ¶
A work function that has sideeffects rather than return values.
type SideEffectWorker ¶
type SideEffectWorker struct {
// contains filtered or unexported fields
}
func NewSideEffectWorker ¶
func NewSideEffectWorker(ctx context.Context, parentwg *sync.WaitGroup, fn SideEffectFn) *SideEffectWorker
func (*SideEffectWorker) SetWorkChan ¶
func (w *SideEffectWorker) SetWorkChan(ch <-chan string)
type Stream ¶
A Stream is a struct with a non-blocking Insert and a GetChan that returns a read-only channel When the insert would have blocked, or the stream is closed an error is returned. Streams should likely be closed by context. String was chosen because it can be a single arg, a list of delimited args, or json
type UniQueue ¶
type UniQueue struct {
// contains filtered or unexported fields
}
func NewUniQueue ¶
func (*UniQueue) Check ¶
Checks if the value exists in the cache most callers should call insert and read the error
func (*UniQueue) GetChan ¶
GetChan returns the output channel, used by n consumers to consume deduped records.
type WorkerPool ¶
A Pool is a struct that performs a preset operation given the submitted string Submit is non-blocking. It returns an error if it would have blocked, if the pool has been closed or if a submission error occurs