Versions in this module Expand all Collapse all v1 v1.1.1 Sep 22, 2025 v1.1.0 Aug 26, 2025 Changes in this version + var ErrorLockNotAcquired = errors.New("go-generics: concurrency: lock not acquired") + var ErrorLockNotRefreshed = errors.New("go-generics: concurrency: lock not refreshed") + var ErrorLockNotReleased = errors.New("go-generics: concurrency: lock not held") + func WrapError(err error, message string) error + type ConcurrencyLimiter struct + func NewConcurrencyLimiter(maxConcurrency int) *ConcurrencyLimiter + func (rp *ConcurrencyLimiter) Run(routine func(), opts ...ConcurrencyLimiterRunOption) + type ConcurrencyLimiterRunConfig struct + type ConcurrencyLimiterRunOption func(cfg ConcurrencyLimiterRunConfig) ConcurrencyLimiterRunConfig + func WithOnCompleteCallback(onComplete func()) ConcurrencyLimiterRunOption + type Lock interface + Refresh func(ctx context.Context) error + Release func(ctx context.Context) error + type LockBackend interface + ObtainLock func(ctx context.Context, name string, ttl time.Duration) (Lock, error) + type LockError struct + Message string + func (le LockError) Error() string + type LockManager struct + func NewLockManager(backend LockBackend) *LockManager + func (lm *LockManager) Acquire(ctx context.Context, key string, ttl time.Duration) (Lock, bool, error) + func (lm *LockManager) ExecuteWithLock(ctx context.Context, key string, lockTTL, timeout time.Duration, ...) error + type LockTimeoutError struct + Key string + func (lte LockTimeoutError) Error() string + type MemoryLockBackend struct + func NewMemoryLockBackend() *MemoryLockBackend + func (mlb *MemoryLockBackend) ObtainLock(ctx context.Context, name string, ttl time.Duration) (Lock, error) + type RedisLockBackend struct + func NewRedisLockBackend(pools ...redis.Pool) *RedisLockBackend + func (r *RedisLockBackend) ObtainLock(ctx context.Context, name string, ttl time.Duration) (Lock, error)