Documentation ¶
Index ¶
- type Consul
- type ConsulConfig
- type HTTPRequest
- type HTTPRequestOption
- func HTTPRequestSetBreakerName(breakerName string) 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 Locker
- type NoopLocker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consul ¶
type Consul struct { Client *api.Client Key string SessionID string LockRetryInterval time.Duration SessionTTL time.Duration MaxJobRebalance int }
Consul configured for lock acquisition
func (*Consul) RetryLockAcquire ¶
func (c *Consul) RetryLockAcquire(value map[string]string, acquired chan<- struct{}, released chan<- struct{})
RetryLockAcquire attempts to acquire the lock at `LockRetryInterval`
type ConsulConfig ¶
type ConsulConfig struct { ConsulAgentHost string ConsulKey string LockRetryInterval time.Duration SessionTTL time.Duration MaxJobRebalance int }
ConsulConfig is used to configure creation of client
type HTTPRequest ¶
type HTTPRequest interface {
Do(context context.Context, method, url string, reqBody []byte, headers map[string]string) ([]byte, int, error)
}
HTTPRequest interface
func NewHTTPRequest ¶
func NewHTTPRequest(opts ...HTTPRequestOption) HTTPRequest
NewHTTPRequest function Request's Constructor Returns : *Request
type HTTPRequestOption ¶
type HTTPRequestOption func(*httpRequestImpl)
HTTPRequestOption func type
func HTTPRequestSetBreakerName ¶
func HTTPRequestSetBreakerName(breakerName string) HTTPRequestOption
HTTPRequestSetBreakerName 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 Locker ¶ added in v1.8.8
Locker abstraction, lock concurrent processs
func NewRedisLocker ¶ added in v1.8.8
NewRedisLocker constructor
type NoopLocker ¶ added in v1.8.8
type NoopLocker struct{}
NoopLocker empty locker
func (NoopLocker) IsLocked ¶ added in v1.8.8
func (NoopLocker) IsLocked(key string) (bool, func())
IsLocked method