pool

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoFn added in v0.7.0

type DoFn[T, R any] func(req T) (R, error)

DoFn[T, R] request handle function

type GoroutinePool

type GoroutinePool[T, R any] interface {
	Start()
	Stop()
	Do(T, ResponseFn[T, R])
}

GoroutinePool[T, R] goroutine pool interface

func NewGoroutinePool

func NewGoroutinePool[T, R any](fn DoFn[T, R], opts ...Option) GoroutinePool[T, R]

NewGoroutinePool[T, R] create a new GoroutinePool[T, R] instance

type GoroutinePool2 added in v0.5.0

type GoroutinePool2[T any] interface {
	Start()
	Stop()
	Run(T, RespFn[T])
}

GoroutinePool2[T] goroutine pool interface

func NewGoroutinePool2 added in v0.5.0

func NewGoroutinePool2[T any](fn RunFn[T], opts ...Option) GoroutinePool2[T]

NewGoroutinePool2[T] create a new GoroutinePool[T, R] instance

type Option added in v0.6.0

type Option = func(opt *gorotinePoolOpt)

Option groutine pool option help function used to create groutine pool instance

func MaxRequestBufOpt added in v0.2.0

func MaxRequestBufOpt(num int) Option

MaxRequestBufOpt set max request buffer size

func MaxRequestTempBufOpt added in v0.2.0

func MaxRequestTempBufOpt(num int) Option

MaxRequestTempBufOpt set max request temp buffer size

func MaxTempWorkerOpt added in v0.9.4

func MaxTempWorkerOpt(num int) Option

func MaxTickCountOpt added in v0.2.0

func MaxTickCountOpt(num int) Option

MaxTickCountOpt set max tick count

func MinWorkerOpt

func MinWorkerOpt(num int) Option

MinWorkerOpt set min worker

func TickWaitTimeOpt added in v0.2.0

func TickWaitTimeOpt(duration time.Duration) Option

TickWaitTimeOpt set tick wait time

func WorkerHookOpt added in v0.9.1

func WorkerHookOpt(h WorkerHook) Option

WorkerHookOpt set wroker hook

type RespFn added in v0.5.0

type RespFn[T any] func(req T, err error)

RespFn[T] response handle function

type ResponseFn

type ResponseFn[T, R any] func(req T, resp R, err error)

ResponseFn[T, R] response handle function

type RunFn added in v0.5.0

type RunFn[T any] func(req T) error

RunFn[T] request handle function

type WorkerHook added in v0.9.1

type WorkerHook interface {
	OnJoin(count int32)
	OnLeave(count int32)
}

WorkerHook hook worker status

Jump to

Keyboard shortcuts

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