candiutils

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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
}

Consul configured for lock acquisition

func NewConsul

func NewConsul(opt *ConsulConfig) (*Consul, error)

NewConsul constructor

func (*Consul) DestroySession

func (c *Consul) DestroySession() error

DestroySession method

func (*Consul) RecreateSession

func (c *Consul) RecreateSession() error

RecreateSession method

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
}

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 added in v1.3.2

type HTTPRequestOption func(*httpRequestImpl)

HTTPRequestOption func type

func HTTPRequestSetHTTPErrorCodeThreshold added in v1.3.2

func HTTPRequestSetHTTPErrorCodeThreshold(minHTTPStatusCode int) HTTPRequestOption

HTTPRequestSetHTTPErrorCodeThreshold option func, set minimum http response code for return error when exec client request

func HTTPRequestSetRetries added in v1.3.2

func HTTPRequestSetRetries(retries int) HTTPRequestOption

HTTPRequestSetRetries option func

func HTTPRequestSetSleepBetweenRetry added in v1.3.2

func HTTPRequestSetSleepBetweenRetry(sleepBetweenRetry time.Duration) HTTPRequestOption

HTTPRequestSetSleepBetweenRetry option func

func HTTPRequestSetTLS added in v1.3.2

func HTTPRequestSetTLS(tlsConfig *tls.Config) HTTPRequestOption

HTTPRequestSetTLS option func

Jump to

Keyboard shortcuts

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