Documentation ¶
Index ¶
- type HTTPRequest
- type HTTPRequestOption
- func HTTPRequestSetBreakerName(breakerName string) HTTPRequestOption
- func HTTPRequestSetClient(cl *http.Client) HTTPRequestOption
- func HTTPRequestSetHTTPErrorCodeThreshold(minHTTPStatusCode int) HTTPRequestOption
- func HTTPRequestSetRetries(retries int) HTTPRequestOption
- func HTTPRequestSetSleepBetweenRetry(sleepBetweenRetry time.Duration) HTTPRequestOption
- func HTTPRequestSetTLS(tlsConfig *tls.Config) HTTPRequestOption
- func HTTPRequestSetTimeout(timeout time.Duration) HTTPRequestOption
- type HTTPRequestResult
- type LockerOption
- type LockerOptions
- type NoopLocker
- func (NoopLocker) Disconnect(context.Context) error
- func (NoopLocker) GetPrefixLocker() string
- func (NoopLocker) GetTTLLocker() time.Duration
- func (NoopLocker) HasBeenLocked(string) bool
- func (NoopLocker) IsLocked(string) bool
- func (NoopLocker) IsLockedTTL(string, time.Duration) bool
- func (NoopLocker) Lock(string, time.Duration) (func(), error)
- func (NoopLocker) Reset(string)
- func (NoopLocker) Unlock(string)
- type RedisLocker
- func (r *RedisLocker) Disconnect(ctx context.Context) error
- func (r *RedisLocker) GetPrefixLocker() string
- func (r *RedisLocker) GetTTLLocker() time.Duration
- func (r *RedisLocker) HasBeenLocked(key string) bool
- func (r *RedisLocker) IsLocked(key string) bool
- func (r *RedisLocker) IsLockedTTL(key string, TTL time.Duration) bool
- func (r *RedisLocker) Lock(key string, timeout time.Duration) (unlockFunc func(), err error)
- func (r *RedisLocker) Reset(key string)
- func (r *RedisLocker) Unlock(key string)
- type SyncPool
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPRequest ¶
type HTTPRequest interface { DoRequest(ctx context.Context, method, url string, requestBody []byte, headers map[string]string) (result *HTTPRequestResult, err error) Do(context context.Context, method, url string, reqBody []byte, headers map[string]string) (respBody []byte, respCode int, err error) }
HTTPRequest interface
func NewHTTPRequest ¶
func NewHTTPRequest(opts ...HTTPRequestOption) HTTPRequest
NewHTTPRequest function Request's Constructor
type HTTPRequestOption ¶
type HTTPRequestOption func(*httpRequestImpl)
HTTPRequestOption func type
func HTTPRequestSetBreakerName ¶
func HTTPRequestSetBreakerName(breakerName string) HTTPRequestOption
HTTPRequestSetBreakerName option func
func HTTPRequestSetClient ¶ added in v1.11.14
func HTTPRequestSetClient(cl *http.Client) HTTPRequestOption
HTTPRequestSetClient option func
func HTTPRequestSetHTTPErrorCodeThreshold ¶
func HTTPRequestSetHTTPErrorCodeThreshold(minHTTPStatusCode int) HTTPRequestOption
HTTPRequestSetHTTPErrorCodeThreshold option func, set minimum http response code for return error when exec client request
func HTTPRequestSetRetries ¶
func HTTPRequestSetRetries(retries int) HTTPRequestOption
HTTPRequestSetRetries option func
func HTTPRequestSetSleepBetweenRetry ¶
func HTTPRequestSetSleepBetweenRetry(sleepBetweenRetry time.Duration) HTTPRequestOption
HTTPRequestSetSleepBetweenRetry option func
func HTTPRequestSetTLS ¶
func HTTPRequestSetTLS(tlsConfig *tls.Config) HTTPRequestOption
HTTPRequestSetTLS option func
func HTTPRequestSetTimeout ¶
func HTTPRequestSetTimeout(timeout time.Duration) HTTPRequestOption
HTTPRequestSetTimeout option func
type HTTPRequestResult ¶ added in v1.11.6
HTTPRequestResult struct
type LockerOption ¶ added in v1.18.2
type LockerOption func(*LockerOptions)
Option function type for setting options
func WithPrefixLocker ¶ added in v1.18.2
func WithPrefixLocker(prefix string) LockerOption
WithPrefix sets the prefix for keys
func WithTTLLocker ¶ added in v1.18.2
func WithTTLLocker(ttl time.Duration) LockerOption
WithTTL sets the default TTL for keys
type LockerOptions ¶ added in v1.18.2
Options for RedisLocker
type NoopLocker ¶ added in v1.8.8
type NoopLocker struct{}
NoopLocker empty locker
func (NoopLocker) Disconnect ¶ added in v1.14.8
func (NoopLocker) Disconnect(context.Context) error
func (NoopLocker) GetPrefixLocker ¶ added in v1.18.2
func (NoopLocker) GetPrefixLocker() string
GetPrefix method
func (NoopLocker) GetTTLLocker ¶ added in v1.18.2
func (NoopLocker) GetTTLLocker() time.Duration
GetTTLLocker method
func (NoopLocker) HasBeenLocked ¶ added in v1.13.6
func (NoopLocker) HasBeenLocked(string) bool
HasBeenLocked method
func (NoopLocker) IsLocked ¶ added in v1.8.8
func (NoopLocker) IsLocked(string) bool
IsLocked method
func (NoopLocker) IsLockedTTL ¶ added in v1.18.2
func (NoopLocker) IsLockedTTL(string, time.Duration) bool
IsLockedTTL method
type RedisLocker ¶ added in v1.14.8
type RedisLocker struct {
// contains filtered or unexported fields
}
RedisLocker lock using redis
func NewRedisLocker ¶ added in v1.8.8
func NewRedisLocker(pool *redis.Pool, opts ...LockerOption) *RedisLocker
NewRedisLocker constructor
func (*RedisLocker) Disconnect ¶ added in v1.14.8
func (r *RedisLocker) Disconnect(ctx context.Context) error
Disconnect close and reset
func (*RedisLocker) GetPrefixLocker ¶ added in v1.18.2
func (r *RedisLocker) GetPrefixLocker() string
GetPrefix returns the prefix used for keys
func (*RedisLocker) GetTTLLocker ¶ added in v1.18.2
func (r *RedisLocker) GetTTLLocker() time.Duration
GetTTLLocker returns the default TTL for keys
func (*RedisLocker) HasBeenLocked ¶ added in v1.14.8
func (r *RedisLocker) HasBeenLocked(key string) bool
func (*RedisLocker) IsLocked ¶ added in v1.14.8
func (r *RedisLocker) IsLocked(key string) bool
func (*RedisLocker) IsLockedTTL ¶ added in v1.18.2
func (r *RedisLocker) IsLockedTTL(key string, TTL time.Duration) bool
func (*RedisLocker) Lock ¶ added in v1.14.8
func (r *RedisLocker) Lock(key string, timeout time.Duration) (unlockFunc func(), err error)
Lock method
func (*RedisLocker) Unlock ¶ added in v1.14.8
func (r *RedisLocker) Unlock(key string)
Unlock method
type SyncPool ¶ added in v1.17.0
type SyncPool[T any] struct { // contains filtered or unexported fields }
func NewSyncPool ¶ added in v1.17.0
type WorkerPool ¶ added in v1.16.2
type WorkerPool[T any] interface { Dispatch(ctx context.Context, jobFunc func(context.Context, T)) AddJob(job T) Finish() }
WorkerPool implementation
func NewWorkerPool ¶ added in v1.16.2
func NewWorkerPool[T any](maxWorker int) WorkerPool[T]
NewWorkerPool create an instance of WorkerPool.