concurrencyx

package module
v0.0.0-...-18135db Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: GPL-3.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

concurrencyx

一个用于管理分布式服务并发量的模块(A module for managing the concurrency of distributed services)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorWaitTimeOut               = errors.New("concurrencyx error: Wait timeout")
	ErrorReachConcurrencyThreshold = errors.New("concurrencyx error: Concurrency threshold reached")
	ErrorInvalidServiceUniqueName  = errors.New("concurrencyx error: Service unique name is invalid")
	ErrorInvalidRedisObject        = errors.New("concurrencyx error: The redis is nil")
	ErrorRedisCanNotConnect        = errors.New("concurrencyx error: Can not connect redis")
	ErrorCreateLockCreator         = errors.New("concurrencyx error: Create lock creator fail")
	ErrorSecondsFiledTooLarge      = errors.New("concurrencyx error: The value of the seconds field of the strategy is too large")
	ErrorThresholdTooSmall         = errors.New("concurrencyx error: The value of the threshold field of the strategy is too small")
)

Functions

This section is empty.

Types

type ConcurrencyX

type ConcurrencyX struct {
	DenyStrategyManagementInterface
	InterfaceConcurrencyX
	// contains filtered or unexported fields
}

func CreateConcurrencyX

func CreateConcurrencyX(ctx context.Context, srvUniqueName string, rDb *redis.Client, denyStrategy map[Seconds]DenyThreshold) (*ConcurrencyX, error)

func (ConcurrencyX) Join

func (x ConcurrencyX) Join(ctx context.Context, waitTimeOut time.Duration) error

type DenyStrategyManagementInterface

type DenyStrategyManagementInterface interface {
	AddStrategy(s Seconds, threshold DenyThreshold) error
	DelStrategy(s Seconds)
	OutPut() *map[Seconds]DenyThreshold
}

type DenyThreshold

type DenyThreshold uint

type InterfaceConcurrencyX

type InterfaceConcurrencyX interface {
	Join(ctx context.Context, waitTimeOut time.Duration) error
}

type Seconds

type Seconds uint // 0 < Seconds <= secondsLimit

Jump to

Keyboard shortcuts

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