package
0.0.0-20240918081624-c908e9e5a282
Repository: https://github.com/go-sohunjug/utils.git
Documentation: pkg.go.dev

# Functions

Cap returns the capacity of this default pool.
Free returns the available goroutines to work.
NewMultiPool instantiates a MultiPool with a size of the pool list and a size per pool, and the load-balancing strategy.
NewMultiPoolWithFunc instantiates a MultiPoolWithFunc with a size of the pool list and a size per pool, and the load-balancing strategy.
NewPool instantiates a Pool with customized options.
NewPoolWithFunc instantiates a PoolWithFunc with customized options.
Reboot reboots the default pool.
Release Closes the default pool.
ReleaseTimeout is like Release but with a timeout, it waits all workers to exit before timing out.
Running returns the number of the currently running goroutines.
Submit submits a task to pool.
WithDisablePurge indicates whether we turn off automatically purge.
WithExpiryDuration sets up the interval time of cleaning up goroutines.
WithLogger sets up a customized logger.
WithMaxBlockingTasks sets up the maximum number of goroutines that are blocked when it reaches the capacity of pool.
WithNonblocking indicates that pool will return nil when there is no available workers.
WithOptions accepts the whole options config.
WithPanicHandler sets up panic handler.
WithPreAlloc indicates whether it should malloc for workers.

# Constants

CLOSED represents that the pool is closed.
DefaultAntsPoolSize is the default capacity for a default goroutine pool.
DefaultCleanIntervalTime is the interval time to clean up goroutines.
LeastTasks always selects the pool with the least number of pending tasks.
OPENED represents that the pool is opened.
RoundRobin distributes task to a list of pools in rotation.

# Variables

ErrInvalidLoadBalancingStrategy will be returned when trying to create a MultiPool with an invalid load-balancing strategy.
ErrInvalidPoolExpiry will be returned when setting a negative number as the periodic duration to purge goroutines.
ErrInvalidPoolIndex will be returned when trying to retrieve a pool with an invalid index.
ErrInvalidPreAllocSize will be returned when trying to set up a negative capacity under PreAlloc mode.
ErrLackPoolFunc will be returned when invokers don't provide function for pool.
ErrPoolClosed will be returned when submitting task to a closed pool.
ErrPoolOverload will be returned when the pool is full and no workers available.
ErrTimeout will be returned after the operations timed out.

# Structs

MultiPool consists of multiple pools, from which you will benefit the performance improvement on basis of the fine-grained locking that reduces the lock contention.
MultiPoolWithFunc consists of multiple pools, from which you will benefit the performance improvement on basis of the fine-grained locking that reduces the lock contention.
Options contains all options which will be applied when instantiating an ants pool.
Pool accepts the tasks and process them concurrently, it limits the total of goroutines to a given number by recycling goroutines.
PoolWithFunc accepts the tasks and process them concurrently, it limits the total of goroutines to a given number by recycling goroutines.

# Interfaces

Logger is used for logging formatted messages.

# Type aliases

LoadBalancingStrategy represents the type of load-balancing algorithm.
Option represents the optional function.