Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Global ¶
type Global struct {
// contains filtered or unexported fields
}
func GlobalSemaphore ¶
func GlobalSemaphore(rc redis.UniversalClient, c SemaphoreConfig, name string) *Global
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
func LocalSemaphore ¶
func LocalSemaphore(c SemaphoreConfig, name string) *Local
type RPM ¶
type RPM interface {
// StorReq acquires storage api request rate limit based on RPM config.
StorReq(ctx context.Context, storage string) error
// StorReqN acquires n storage api requests rate limit based on RPM config.
StorReqN(ctx context.Context, storage string, n int) error
}
RPM storage rate limit based on requests per minute
type Semaphore ¶
type Semaphore interface {
// TryAcquire tries to acquire storage resource until work function is done.
// Returns release function. Also, will be released when ctx cancelled.
// Returns dom.ErrRateLimitExceeded if resource is not acquired.
TryAcquire(ctx context.Context) (release func(), err error)
// TryAcquireN - see TryAcquire
TryAcquireN(ctx context.Context, n int64) (release func(), err error)
}
Semaphore storage rate limit based on N concurrent resource clients.
type SemaphoreConfig ¶
Click to show internal directories.
Click to hide internal directories.