pool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoFn

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

GoFn[T, R] request handle function

type GorotinePoolOptFn

type GorotinePoolOptFn = func(opt *gorotinePoolOpt)

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

func MaxRequestBuffer

func MaxRequestBuffer(num int) GorotinePoolOptFn

MaxRequestBuffer set max request buffer size

func MaxRequestTempBuffer

func MaxRequestTempBuffer(num int) GorotinePoolOptFn

MaxRequestTempBuffer set max request temp buffer size

func MaxTickCount

func MaxTickCount(num int) GorotinePoolOptFn

MaxTickCount set max tick count

func MinWorkerOpt

func MinWorkerOpt(num int) GorotinePoolOptFn

MinWorkerOpt set min worker

func TickWaitTime

func TickWaitTime(duration time.Duration) GorotinePoolOptFn

TickWaitTime set tick wait time

type GoroutinePool

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

GoroutinePool[T, R] goroutine pool interface

func NewGoroutinePool

func NewGoroutinePool[T, R any](fn GoFn[T, R], opts ...GorotinePoolOptFn) GoroutinePool[T, R]

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

type ResponseFn

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

ResponseFn[T, R] response handle function

Jump to

Keyboard shortcuts

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