Documentation
¶
Index ¶
- Constants
- Variables
- func ByteToGiB(bytes float64) float64
- func CheckIfSameCluster(ctx context.Context, ...) (_ bool, addrs, addrs2 []string, err error)
- func CheckSupportX509NameOneline(oneline string) (err error)
- func ClientWithTLS(tlsCfg *tls.Config) *http.Client
- func ColumnToProto(c *model.ColumnInfo, forIndex bool, isTiFlashStore bool) *tipb.ColumnInfo
- func ColumnsToProto(columns []*model.ColumnInfo, pkIsHandle bool, forIndex bool, ...) []*tipb.ColumnInfo
- func ComposeURL(address, path string) string
- func CreateCertificates(certpath string, keypath string, rsaKeySize int, ...) error
- func DelKeyWithPrefix(rm kv.RetrieverMutator, prefix kv.Key) error
- func FmtNonASCIIPrintableCharToHex(str string, maxBytesToShow int, displayDeleteCharater bool) string
- func FormatLeaseID(id clientv3.LeaseID) string
- func GenLogFields(costTime time.Duration, info *sessmgr.ProcessInfo, needTruncateSQL bool) []zap.Field
- func GenRLimit(source string) uint64
- func GetCPUPercentage() float64
- func GetGOGC() int
- func GetJSON(client *http.Client, url string, v any) error
- func GetLocalIP() string
- func GetPDsAddrWithoutScheme(db *sql.DB) func(context.Context) ([]string, error)
- func GetRawInfo(app string) string
- func GetRecoverError(r any) error
- func GetTypeFlagsForImportInto(baseFlags types.Flags, sqlMode mysql.SQLMode) types.Flags
- func GetTypeFlagsForInsert(baseFlags types.Flags, sqlMode mysql.SQLMode, ignoreErr bool) types.Flags
- func GetValuesList(lower, upper []byte, num int, valuesList [][]byte) [][]byte
- func HasCancelled(ctx context.Context) (cancel bool)
- func InternalHTTPClient() *http.Client
- func InternalHTTPSchema() string
- func IsInCorrectIdentifierName(name string) bool
- func LoadTLSCertificates(ca, key, cert string, autoTLS bool, rsaKeySize int) (tlsConfig *tls.Config, autoReload bool, err error)
- func MockPkixAttribute(name, value string) pkix.AttributeTypeAndValue
- func NewSession(ctx context.Context, logPrefix string, etcdCli *clientv3.Client, ...) (*concurrency.Session, error)
- func NewTCPConnWithIOCounter(conn *net.TCPConn, c *atomic.Uint64) net.Conn
- func NewTLSConfig(opts ...TLSConfigOption) (*tls.Config, error)
- func OriginError(err error) error
- func ParseAndCheckSAN(san string) (map[SANType][]string, error)
- func ParseHostPortAddr(s string) ([]string, error)
- func PrintInfo(app string)
- func PrintableASCII(b byte) bool
- func ProtoV1Clone[T protoadapt.MessageV1](p T) T
- func ReadLine(reader *bufio.Reader, maxLineSize int) ([]byte, error)
- func ReadLines(reader *bufio.Reader, count int, maxLineSize int) ([][]byte, error)
- func Recover(metricsLabel, funcInfo string, recoverFn func(), quit bool)
- func RowKeyPrefixFilter(rowKeyPrefix kv.Key) kv.FnKeyCmp
- func RunWithRetry(retryCnt int, backoff uint64, f func() (bool, error)) (err error)
- func ScanMetaWithPrefix(retriever kv.Retriever, prefix kv.Key, filter func(kv.Key, []byte) bool) error
- func SetGOGC(val int) int
- func SliceToMap(slice []string) map[string]any
- func Str2Int64Map(str string) map[int64]struct{}
- func StringsToInterfaces(strs []string) []any
- func SyntaxError(err error) error
- func SyntaxWarn(err error) error
- func ToTLSConfig(caPath, certPath, keyPath string) (*tls.Config, error)
- func ToTLSConfigWithVerify(caPath, certPath, keyPath string, verifyCN []string) (*tls.Config, error)
- func WithRecovery(exec func(), recoverFn func(r any))
- func X509NameOnline(n pkix.Name) string
- type DestroyableSessionPool
- type ErrorGroupWithRecover
- type IDGenerator
- type SANType
- type SequenceTable
- type SessionPool
- type TCPConnWithIOCounter
- type TLS
- type TLSConfigOption
- func WithCAContent(caContent []byte) TLSConfigOption
- func WithCAPath(caPath string) TLSConfigOption
- func WithCertAndKeyContent(certContent, keyContent []byte) TLSConfigOption
- func WithCertAndKeyPath(certPath, keyPath string) TLSConfigOption
- func WithMinTLSVersion(minTLSVersion uint16) TLSConfigOption
- func WithVerifyCommonName(verifyCN []string) TLSConfigOption
- type Token
- type TokenLimiter
- type WaitGroupEnhancedWrapper
- type WaitGroupPool
- type WaitGroupWrapper
- type Worker
- type WorkerPool
- func (pool *WorkerPool) Apply(fn func())
- func (pool *WorkerPool) ApplyOnErrorGroup(eg *errgroup.Group, fn func() error)
- func (pool *WorkerPool) ApplyWithID(fn func(uint64))
- func (pool *WorkerPool) ApplyWithIDInErrorGroup(eg *errgroup.Group, fn func(id uint64) error)
- func (pool *WorkerPool) ApplyWorker() *Worker
- func (pool *WorkerPool) HasWorker() bool
- func (pool *WorkerPool) IdleCount() int
- func (pool *WorkerPool) Limit() int
- func (pool *WorkerPool) RecycleWorker(worker *Worker)
Constants ¶
const ( // NewSessionDefaultRetryCnt is the default retry times when create new session. NewSessionDefaultRetryCnt = 3 // NewSessionRetryUnlimited is the unlimited retry times when create new session. NewSessionRetryUnlimited = math.MaxInt64 )
const ( // DefaultMaxRetries indicates the max retry count. DefaultMaxRetries = 30 // RetryInterval indicates retry interval. RetryInterval uint64 = 500 )
const ( // Country is type name for country. Country = "C" // Organization is type name for organization. Organization = "O" // OrganizationalUnit is type name for organizational unit. OrganizationalUnit = "OU" // Locality is type name for locality. Locality = "L" // Email is type name for email. Email = "emailAddress" // CommonName is type name for common name. CommonName = "CN" // Province is type name for province or state. Province = "ST" )
const ( // URI indicates uri info in SAN. URI = SANType("URI") // DNS indicates dns info in SAN. DNS = SANType("DNS") // IP indicates ip info in SAN. IP = SANType("IP") )
const ByteNumOneGiB int64 = 1024 * 1024 * 1024
ByteNumOneGiB shows how many bytes one GiB contains
const (
// SyntaxErrorPrefix is the common prefix for SQL syntax error in TiDB.
SyntaxErrorPrefix = "You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use"
)
Variables ¶
var ( Version = "None" BuildTS = "None" GitHash = "None" GitBranch = "None" )
Version information.
var GetSequenceByName func(is infoschema.MetaOnlyInfoSchema, schema, sequence ast.CIStr) (SequenceTable, error)
GetSequenceByName could be used in expression package without import cycle problem.
Functions ¶
func CheckIfSameCluster ¶
func CheckIfSameCluster( ctx context.Context, pdAddrsGetter, pdAddrsGetter2 func(context.Context) ([]string, error), ) (_ bool, addrs, addrs2 []string, err error)
CheckIfSameCluster reads PD addresses registered in etcd from two sources, to check if there are common addresses in both sources. If there are common addresses, the first return value is true which means we have confidence that the two sources are in the same cluster. If there are no common addresses, the first return value is false, which means 1) the two sources are in different clusters, or 2) the two sources may be in the same cluster but the getter function does not return the common addresses.
The getters should keep the same format of the returned addresses, like both have URL scheme or not.
The second and third return values are the PD addresses from the first and second getters respectively. The fourth return value is the error occurred.
func CheckSupportX509NameOneline ¶
CheckSupportX509NameOneline parses and validate input str is X509_NAME_oneline format and precheck check-item is supported by TiDB https://www.openssl.org/docs/manmaster/man3/X509_NAME_oneline.html
func ClientWithTLS ¶
ClientWithTLS creates a http client wit tls
func ColumnToProto ¶
func ColumnToProto(c *model.ColumnInfo, forIndex bool, isTiFlashStore bool) *tipb.ColumnInfo
ColumnToProto converts model.ColumnInfo to tipb.ColumnInfo.
func ColumnsToProto ¶
func ColumnsToProto(columns []*model.ColumnInfo, pkIsHandle bool, forIndex bool, isTiFlashStore bool) []*tipb.ColumnInfo
ColumnsToProto converts a slice of model.ColumnInfo to a slice of tipb.ColumnInfo.
func ComposeURL ¶
ComposeURL adds HTTP schema if missing and concats address with path
func CreateCertificates ¶
func CreateCertificates(certpath string, keypath string, rsaKeySize int, pubKeyAlgo x509.PublicKeyAlgorithm, signAlgo x509.SignatureAlgorithm) error
CreateCertificates creates and writes a cert based on the params.
func DelKeyWithPrefix ¶
func DelKeyWithPrefix(rm kv.RetrieverMutator, prefix kv.Key) error
DelKeyWithPrefix deletes keys with prefix.
func FmtNonASCIIPrintableCharToHex ¶
func FmtNonASCIIPrintableCharToHex(str string, maxBytesToShow int, displayDeleteCharater bool) string
FmtNonASCIIPrintableCharToHex turns non-printable-ASCII characters into Hex
func FormatLeaseID ¶
FormatLeaseID formats lease id to hex string as what etcdctl does. see https://github.com/etcd-io/etcd/blob/995027f5c1363404e86f7a858ea2833df01f0954/etcdctl/ctlv3/command/printer_simple.go#L118
func GenLogFields ¶
func GenLogFields(costTime time.Duration, info *sessmgr.ProcessInfo, needTruncateSQL bool) []zap.Field
GenLogFields generate log fields.
func GetCPUPercentage ¶
func GetCPUPercentage() float64
GetCPUPercentage calculates CPU usage and returns percentage in float64(e.g. 2.5 means 2.5%). http://man7.org/linux/man-pages/man2/getrusage.2.html
func GetJSON ¶
GetJSON fetches a page and parses it as JSON. The parsed result will be stored into the `v`. The variable `v` must be a pointer to a type that can be unmarshalled from JSON.
Example:
client := &http.Client{}
var resp struct { IP string }
if err := util.GetJSON(client, "http://api.ipify.org/?format=json", &resp); err != nil {
return errors.Trace(err)
}
fmt.Println(resp.IP)
nolint:unused
func GetLocalIP ¶
func GetLocalIP() string
GetLocalIP will return a local IP(non-loopback, non 0.0.0.0), if there is one
func GetPDsAddrWithoutScheme ¶
GetPDsAddrWithoutScheme returns a function that read all PD nodes' first etcd client URL by SQL query. This is done by query INFORMATION_SCHEMA.CLUSTER_INFO table and its executor memtableRetriever.dataForTiDBClusterInfo.
func GetRawInfo ¶
GetRawInfo do what its name tells nolint:unused
func GetRecoverError ¶
GetRecoverError gets the error from recover.
func GetTypeFlagsForImportInto ¶
GetTypeFlagsForImportInto gets the type flags for import into statement which has the same flags as normal `INSERT INTO xxx`.
func GetTypeFlagsForInsert ¶
func GetTypeFlagsForInsert(baseFlags types.Flags, sqlMode mysql.SQLMode, ignoreErr bool) types.Flags
GetTypeFlagsForInsert gets the type flags for insert statement.
func GetValuesList ¶
GetValuesList is used to get `num` values between lower and upper value. To Simplify the explain, suppose lower and upper value type is int64, and lower=0, upper=100, num=10, then calculate the step=(upper-lower)/num=10, then the function should return 0+10, 10+10, 20+10... all together 9 (num-1) values. Then the function will return [10,20,30,40,50,60,70,80,90]. The difference is the value type of upper, lower is []byte, So I use getUint64FromBytes to convert []byte to uint64.
func HasCancelled ¶
HasCancelled checks whether context has be cancelled.
func InternalHTTPClient ¶
InternalHTTPClient is used by TiDB-Server to request other components.
func InternalHTTPSchema ¶
func InternalHTTPSchema() string
InternalHTTPSchema specifies use http or https to request other components.
func IsInCorrectIdentifierName ¶
IsInCorrectIdentifierName checks if the identifier is incorrect. See https://dev.mysql.com/doc/refman/5.7/en/identifiers.html
func LoadTLSCertificates ¶
func LoadTLSCertificates(ca, key, cert string, autoTLS bool, rsaKeySize int) (tlsConfig *tls.Config, autoReload bool, err error)
LoadTLSCertificates loads CA/KEY/CERT for special paths.
func MockPkixAttribute ¶
func MockPkixAttribute(name, value string) pkix.AttributeTypeAndValue
MockPkixAttribute generates mock AttributeTypeAndValue. only used for test.
func NewSession ¶
func NewSession(ctx context.Context, logPrefix string, etcdCli *clientv3.Client, retryCnt, ttl int) (*concurrency.Session, error)
NewSession creates a new etcd session.
func NewTCPConnWithIOCounter ¶
NewTCPConnWithIOCounter creates a new TCPConnWithIOCounter.
func NewTLSConfig ¶
func NewTLSConfig(opts ...TLSConfigOption) (*tls.Config, error)
NewTLSConfig creates a tls.Config from the given options. If no certificate is provided, it will return (nil, nil).
func ParseAndCheckSAN ¶
ParseAndCheckSAN parses and check SAN str.
func ParseHostPortAddr ¶
ParseHostPortAddr returns a scheme://host:port or host:port list
func PrintInfo ¶
func PrintInfo(app string)
PrintInfo prints the app's basic information in log nolint:unused
func PrintableASCII ¶
PrintableASCII detects if b is a printable ASCII character. Ref to:http://facweb.cs.depaul.edu/sjost/it212/documents/ascii-pr.htm
func ProtoV1Clone ¶
func ProtoV1Clone[T protoadapt.MessageV1](p T) T
ProtoV1Clone clones a V1 proto message.
func ReadLine ¶
ReadLine tries to read a complete line from bufio.Reader. maxLineSize specifies the maximum size of a single line.
func ReadLines ¶
ReadLines tries to read lines from bufio.Reader. count specifies the number of lines. maxLineSize specifies the maximum size of a single line.
func Recover ¶
Recover includes operations such as recovering, clearing,and printing information. It will dump current goroutine stack into log if catch any recover result.
metricsLabel: The label of PanicCounter metrics. funcInfo: Some information for the panic function. recoverFn: Handler will be called after recover and before dump stack, passing `nil` means noop. quit: If this value is true, the current program exits after recovery.
func RowKeyPrefixFilter ¶
RowKeyPrefixFilter returns a function which checks whether currentKey has decoded rowKeyPrefix as prefix.
func RunWithRetry ¶
RunWithRetry will run the f with backoff and retry. retryCnt: Max retry count backoff: When run f failed, it will sleep backoff * triedCount time.Millisecond. Function f should have two return value. The first one is an bool which indicate if the err is retryable. The second is if the f meet any error.
func ScanMetaWithPrefix ¶
func ScanMetaWithPrefix(retriever kv.Retriever, prefix kv.Key, filter func(kv.Key, []byte) bool) error
ScanMetaWithPrefix scans metadata with the prefix.
func SliceToMap ¶
SliceToMap converts slice to map nolint:unused
func Str2Int64Map ¶
Str2Int64Map converts a string to a map[int64]struct{}.
func StringsToInterfaces ¶
StringsToInterfaces converts string slice to interface slice
func SyntaxError ¶
SyntaxError converts parser error to TiDB's syntax error.
func SyntaxWarn ¶
SyntaxWarn converts parser warn to TiDB's syntax warn.
func ToTLSConfig ¶
ToTLSConfig generates tls's config.
func ToTLSConfigWithVerify ¶
func ToTLSConfigWithVerify(caPath, certPath, keyPath string, verifyCN []string) (*tls.Config, error)
ToTLSConfigWithVerify constructs a `*tls.Config` from the CA, certification and key paths, and add verify for CN.
If the CA path is empty, returns nil.
func WithRecovery ¶
func WithRecovery(exec func(), recoverFn func(r any))
WithRecovery wraps goroutine startup call with force recovery. it will dump current goroutine stack into log if catch any recover result.
exec: execute logic function. recoverFn: handler will be called after recover and before dump stack, passing `nil` means noop.
func X509NameOnline ¶
X509NameOnline prints pkix.Name into old X509_NAME_oneline format. https://www.openssl.org/docs/manmaster/man3/X509_NAME_oneline.html
Types ¶
type DestroyableSessionPool ¶
type DestroyableSessionPool interface {
SessionPool
Destroy(pools.Resource)
}
DestroyableSessionPool is a session pool that can destroy the session resource. If the caller meets an error when using the session, it can destroy the session. See more by searching `StoreInternalSession`.
func NewSessionPool ¶
func NewSessionPool(capacity int, factory pools.Factory, getCallback, putCallback, destroyCallback resourceCallback) DestroyableSessionPool
NewSessionPool creates a new session pool with the given capacity and factory function.
type ErrorGroupWithRecover ¶
ErrorGroupWithRecover will recover panic from error group. Please note that panic will break the control flow unexpectedly, even if we recover it some key logic may be skipped due to panic, for example, Mutex.Unlock(), and continue running may cause unexpected behaviour. Use it with caution.
func NewErrorGroupWithRecover ¶
func NewErrorGroupWithRecover() *ErrorGroupWithRecover
NewErrorGroupWithRecover creates a ErrorGroupWithRecover.
func NewErrorGroupWithRecoverWithCtx ¶
func NewErrorGroupWithRecoverWithCtx(ctx context.Context) (*ErrorGroupWithRecover, context.Context)
NewErrorGroupWithRecoverWithCtx is like errgroup.WithContext, but returns a ErrorGroupWithRecover.
func (*ErrorGroupWithRecover) Go ¶
func (g *ErrorGroupWithRecover) Go(fn func() error)
Go is like errgroup.Group.Go, but convert panic and its stack into error.
type IDGenerator ¶
type IDGenerator struct {
// contains filtered or unexported fields
}
IDGenerator util class used for generate auto-increasing id
type SequenceTable ¶
type SequenceTable interface {
GetSequenceID() int64
GetSequenceNextVal(ctx any, dbName, seqName string) (int64, error)
SetSequenceVal(ctx any, newVal int64, dbName, seqName string) (int64, bool, error)
}
SequenceTable is implemented by tableCommon, and it is specialised in handling sequence operation. Otherwise calling table will cause import cycle problem.
type SessionPool ¶
SessionPool is a recyclable resource pool for the session.
type TCPConnWithIOCounter ¶
TCPConnWithIOCounter is a wrapper of net.TCPConn with counter that accumulates the bytes this connection reads/writes.
type TLS ¶
type TLS struct {
// contains filtered or unexported fields
}
TLS saves some information about tls
type TLSConfigOption ¶
type TLSConfigOption func(*tlsConfigBuilder)
TLSConfigOption is used to build a tls.Config in NewTLSConfig.
func WithCAContent ¶
func WithCAContent(caContent []byte) TLSConfigOption
WithCAContent sets the CA content to build a tls.Config, and the peer should use the certificate which can be verified by this CA. It has lower priority than WithCAPath. empty `caContent` is no-op.
func WithCAPath ¶
func WithCAPath(caPath string) TLSConfigOption
WithCAPath sets the CA path to build a tls.Config, and the peer should use the certificate which can be verified by this CA. It has higher priority than WithCAContent. empty `caPath` is no-op.
func WithCertAndKeyContent ¶
func WithCertAndKeyContent(certContent, keyContent []byte) TLSConfigOption
WithCertAndKeyContent sets the client certificate and primary key content to build a tls.Config. It has lower priority than WithCertAndKeyPath. empty `certContent`/`keyContent` is no-op.
func WithCertAndKeyPath ¶
func WithCertAndKeyPath(certPath, keyPath string) TLSConfigOption
WithCertAndKeyPath sets the client certificate and primary key path to build a tls.Config. It has higher priority than WithCertAndKeyContent. empty `certPath`/`keyPath` is no-op. WithCertAndKeyPath also support rotation, which means if the client certificate or primary key file is changed, the new content will be used.
func WithMinTLSVersion ¶
func WithMinTLSVersion(minTLSVersion uint16) TLSConfigOption
WithMinTLSVersion sets the min tls version to build a tls.Config.
func WithVerifyCommonName ¶
func WithVerifyCommonName(verifyCN []string) TLSConfigOption
WithVerifyCommonName sets the Common Name the peer must provide before starting a TLS connection. empty `verifyCN` is no-op.
type TokenLimiter ¶
type TokenLimiter struct {
// contains filtered or unexported fields
}
TokenLimiter is used to limit the number of concurrent tasks.
func NewTokenLimiter ¶
func NewTokenLimiter(count uint) *TokenLimiter
NewTokenLimiter creates a TokenLimiter with count tokens.
type WaitGroupEnhancedWrapper ¶
WaitGroupEnhancedWrapper wrapper wg, it provides the basic ability of WaitGroupWrapper with checking unexited process if the `exited` signal is true by print them on log.
func NewWaitGroupEnhancedWrapper ¶
func NewWaitGroupEnhancedWrapper(source string, exit chan struct{}, exitedCheck bool) *WaitGroupEnhancedWrapper
NewWaitGroupEnhancedWrapper returns WaitGroupEnhancedWrapper, the empty source indicates the unit test, then the `checkUnExitedProcess` won't be executed.
func (*WaitGroupEnhancedWrapper) Run ¶
func (w *WaitGroupEnhancedWrapper) Run(exec func(), label string)
Run runs a function in a goroutine, adds 1 to WaitGroup and calls done when function returns. Please DO NOT use panic in the cb function. Note that the registered label shouldn't be duplicated.
func (*WaitGroupEnhancedWrapper) RunWithRecover ¶
func (w *WaitGroupEnhancedWrapper) RunWithRecover(exec func(), recoverFn func(r any), label string)
RunWithRecover wraps goroutine startup call with force recovery, add 1 to WaitGroup and call done when function return. exec is that execute logic function. recoverFn is that handler will be called after recover and before dump stack, passing `nil` means noop. Note that the registered label shouldn't be duplicated.
type WaitGroupPool ¶
WaitGroupPool is a wrapper for sync.WaitGroup and support goroutine pool
func NewWaitGroupPool ¶
func NewWaitGroupPool(gp *gp.Pool) *WaitGroupPool
NewWaitGroupPool returns WaitGroupPool
func (*WaitGroupPool) Run ¶
func (w *WaitGroupPool) Run(exec func())
Run runs a function in a goroutine, adds 1 to WaitGroup and calls done when function returns. Please DO NOT use panic in the cb function.
type WaitGroupWrapper ¶
WaitGroupWrapper is a wrapper for sync.WaitGroup
func (*WaitGroupWrapper) Run ¶
func (w *WaitGroupWrapper) Run(exec func())
Run runs a function in a goroutine, adds 1 to WaitGroup and calls done when function returns. Please DO NOT use panic in the cb function.
func (*WaitGroupWrapper) RunWithLog ¶
func (w *WaitGroupWrapper) RunWithLog(exec func())
RunWithLog works like Run, but it also logs on panic.
func (*WaitGroupWrapper) RunWithRecover ¶
func (w *WaitGroupWrapper) RunWithRecover(exec func(), recoverFn func(r any))
RunWithRecover wraps goroutine startup call with force recovery, add 1 to WaitGroup and call done when function return. it will dump current goroutine stack into log if catch any recover result. exec is that execute logic function. recoverFn is that handler will be called after recover and before dump stack, passing `nil` means noop.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool contains a pool of workers.
func NewWorkerPool ¶
func NewWorkerPool(limit uint, name string) *WorkerPool
NewWorkerPool returns a WorkPool.
func (*WorkerPool) ApplyOnErrorGroup ¶
func (pool *WorkerPool) ApplyOnErrorGroup(eg *errgroup.Group, fn func() error)
ApplyOnErrorGroup executes a task in an errorgroup.
func (*WorkerPool) ApplyWithID ¶
func (pool *WorkerPool) ApplyWithID(fn func(uint64))
ApplyWithID execute a task and provides it with the worker ID.
func (*WorkerPool) ApplyWithIDInErrorGroup ¶
func (pool *WorkerPool) ApplyWithIDInErrorGroup(eg *errgroup.Group, fn func(id uint64) error)
ApplyWithIDInErrorGroup executes a task in an errorgroup and provides it with the worker ID.
func (*WorkerPool) ApplyWorker ¶
func (pool *WorkerPool) ApplyWorker() *Worker
ApplyWorker apply a worker.
func (*WorkerPool) HasWorker ¶
func (pool *WorkerPool) HasWorker() bool
HasWorker checks if the pool has unallocated workers.
func (*WorkerPool) IdleCount ¶
func (pool *WorkerPool) IdleCount() int
IdleCount counts how many idle workers in the pool.
func (*WorkerPool) RecycleWorker ¶
func (pool *WorkerPool) RecycleWorker(worker *Worker)
RecycleWorker recycle a worker.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
ucadata/generator
command
|
|
|
ucaimpl
command
|
|
|
dbutiltest
Package dbutiltest is a package for some common used methods for db related testing.
|
Package dbutiltest is a package for some common used methods for db related testing. |
|
linter
|
|
|
Package mock is just for test only.
|
Package mock is just for test only. |
|
compat
Package compat provides compatibility functions for different versions of SEM
|
Package compat provides compatibility functions for different versions of SEM |
|
mock
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
|
sys
|
|