godropbox: github.com/dropbox/godropbox/executor Index | Files

package executor

import "github.com/dropbox/godropbox/executor"

Index

Package Files

executor.go

type Executor Uses

type Executor interface {
    Process(req Request) *sync.WaitGroup
    ProcessWithWaitGroup(r Request, wg *sync.WaitGroup)
}

type InlineableRequest Uses

type InlineableRequest interface {
    Request

    CanExecuteInline()
}

If the request implements the InlineableRequest interface, the executor may process the request using the Process/ProcessWithGroupGroup's caller goroutine.

NOTE: The executor will only look at the CanExecuteInline method signature (it will not invoke the method).

type Request Uses

type Request interface {
    // The executor will call this method to serve the request.
    Execute()

    // The executor will call this method if the executor cannot serve the
    // request.  Cancel should be a cheap operation than Execute.
    Cancel()
}

type WorkPoolExecutor Uses

type WorkPoolExecutor struct {
    // contains filtered or unexported fields
}

Process requests using a fixed number of workers (when configured) to limit concurrency. Requests are processed in LIFO order.

NOTE: When the number of workers is set to unlimited, the executor may process the request using the Process/ProcessWithWaitGroup's caller goroutine if the request implements the InlineableRequest interface.

func NewWorkPoolExecutor Uses

func NewWorkPoolExecutor() *WorkPoolExecutor

func (*WorkPoolExecutor) Configure Uses

func (p *WorkPoolExecutor) Configure(params WorkPoolExecutorParams) error

func (*WorkPoolExecutor) HighWaterMark Uses

func (p *WorkPoolExecutor) HighWaterMark() int

func (*WorkPoolExecutor) NumWorkers Uses

func (p *WorkPoolExecutor) NumWorkers() int

func (*WorkPoolExecutor) Params Uses

func (p *WorkPoolExecutor) Params() WorkPoolExecutorParams

func (*WorkPoolExecutor) Process Uses

func (p *WorkPoolExecutor) Process(req Request) *sync.WaitGroup

func (*WorkPoolExecutor) ProcessWithWaitGroup Uses

func (p *WorkPoolExecutor) ProcessWithWaitGroup(r Request, wg *sync.WaitGroup)

func (*WorkPoolExecutor) Size Uses

func (p *WorkPoolExecutor) Size() int

type WorkPoolExecutorParams Uses

type WorkPoolExecutorParams struct {
    // The number of worker in this pool.  Non-positive means unlimited.
    NumWorkers int

    // The amount of time a request can be in the queue before the request
    // gets cancelled.  If the value is non-positive, timeout is disabled.
    QueueTimeout time.Duration

    // How frequent should the work pool sweeps timed out requests from its
    // queue. CheckInterval must by positive when QueueTimeout is enabled.
    CheckInterval time.Duration
}

Package executor imports 3 packages (graph). Updated 2017-10-16. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).