router

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWorkerSize      = 100
	DefaultWorkerSpwanSize = 10
	DefaultWorkerCap       = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options func(*Router)

func WithNewQueueFunc

func WithNewQueueFunc(f queue.NewQueue) Options

func WithWorkerGroupCap

func WithWorkerGroupCap(cap int) Options

func WithWorkerSize

func WithWorkerSize(size int) Options

func WithWorkerSpwanSize

func WithWorkerSpwanSize(spwan int) Options

type Router

type Router struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(opts ...Options) *Router

func (*Router) Dispatch

func (r *Router) Dispatch(f func() error, callback ...queue.Finalizer) queue.Task

func (*Router) DispatchPath

func (r *Router) DispatchPath(path string, f func() error, callback ...queue.Finalizer) queue.Task

func (*Router) DispatchPathTask

func (r *Router) DispatchPathTask(path string, task queue.Task)

func (*Router) DispatchTask

func (r *Router) DispatchTask(f queue.Task)

func (*Router) Stop

func (r *Router) Stop()

func (*Router) StopByID

func (r *Router) StopByID(id string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL