client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBaseRetryDelay is base delay for throttled requests
	DefaultBaseRetryDelay = 70 * time.Millisecond
	// DefaultMaxBackoffDelay is max backoff delay for throttled requests
	DefaultMaxBackoffDelay = 20 * time.Second
)
View Source
const (
	ErrCodeNotImplemented      = "NotImplemented"
	ErrCodeValidationException = "ValidationException"
	ErrCodeServiceUnavailable  = "ServiceUnavailable"
	ErrCodeUnknown             = "Unknown"
	ErrCodeThrottlingException = "ThrottlingException"
	ErrCodeInvalidParameter    = "InvalidParameter"
	ErrCodeResponseTimeout     = "ResponseTimeout"
	ErrCodeInternalServerError = "InternalServerError"
)
View Source
const (
	OpGetItem            = "GetItem"
	OpPutItem            = "PutItem"
	OpUpdateItem         = "UpdateItem"
	OpDeleteItem         = "DeleteItem"
	OpBatchGetItem       = "BatchGetItem"
	OpBatchWriteItem     = "BatchWriteItem"
	OpTransactGetItems   = "TransactGetItems"
	OpTransactWriteItems = "TransactWriteItems"
	OpQuery              = "Query"
	OpScan               = "Scan"
)

Variables

Functions

func IsThrottleError

func IsThrottleError(err error) bool

func RejectCustomMiddleware

func RejectCustomMiddleware(apiOptions []func(*middleware.Stack) error) error

rejectCustomMiddleware checks if APIOptions are present and returns an error if they are. It's used to explicitly prevent custom middleware usage in the DAX client.

func SleepWithContext

func SleepWithContext(ctx context.Context, op string, dur time.Duration) error

SleepWithContext will wait for the timer duration to expire, or the context is canceled. Which ever happens first. If the context is canceled the Context's error will be returned.

Expects Context to always return a non-nil error if the Done channel is closed.

func ValidateOpBatchGetItemInput

func ValidateOpBatchGetItemInput(v *dynamodb.BatchGetItemInput) error

func ValidateOpBatchWriteItemInput

func ValidateOpBatchWriteItemInput(v *dynamodb.BatchWriteItemInput) error

func ValidateOpDeleteItemInput

func ValidateOpDeleteItemInput(v *dynamodb.DeleteItemInput) error

func ValidateOpGetItemInput

func ValidateOpGetItemInput(v *dynamodb.GetItemInput) error

func ValidateOpPutItemInput

func ValidateOpPutItemInput(v *dynamodb.PutItemInput) error

func ValidateOpQueryInput

func ValidateOpQueryInput(v *dynamodb.QueryInput) error

func ValidateOpScanInput

func ValidateOpScanInput(v *dynamodb.ScanInput) error

func ValidateOpTransactGetItemsInput

func ValidateOpTransactGetItemsInput(v *dynamodb.TransactGetItemsInput) error

func ValidateOpTransactWriteItemsInput

func ValidateOpTransactWriteItemsInput(v *dynamodb.TransactWriteItemsInput) error

func ValidateOpUpdateItemInput

func ValidateOpUpdateItemInput(v *dynamodb.UpdateItemInput) error

Types

type ClusterDaxClient

type ClusterDaxClient struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*ClusterDaxClient, error)

func (*ClusterDaxClient) BatchGetItemWithOptions

func (*ClusterDaxClient) BatchWriteItemWithOptions

func (*ClusterDaxClient) Close

func (cc *ClusterDaxClient) Close() error

func (*ClusterDaxClient) DeleteItemWithOptions

func (*ClusterDaxClient) GetItemWithOptions

func (*ClusterDaxClient) PutItemWithOptions

func (*ClusterDaxClient) QueryWithOptions

func (cc *ClusterDaxClient) QueryWithOptions(ctx context.Context, input *dynamodb.QueryInput, output *dynamodb.QueryOutput, opt RequestOptions) (*dynamodb.QueryOutput, error)

func (*ClusterDaxClient) ScanWithOptions

func (cc *ClusterDaxClient) ScanWithOptions(ctx context.Context, input *dynamodb.ScanInput, output *dynamodb.ScanOutput, opt RequestOptions) (*dynamodb.ScanOutput, error)

func (*ClusterDaxClient) UpdateItemWithOptions

type Config

type Config struct {
	MaxPendingConnectionsPerHost int
	ClusterUpdateThreshold       time.Duration
	ClusterUpdateInterval        time.Duration
	IdleConnectionReapDelay      time.Duration
	ClientHealthCheckInterval    time.Duration

	Region      string
	HostPorts   []string
	Credentials aws.CredentialsProvider
	DialContext func(ctx context.Context, network string, address string) (net.Conn, error)

	SkipHostnameVerification bool

	RouteManagerEnabled bool // this flag temporarily removes routes facing network errors.
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) SetLogger

func (cfg *Config) SetLogger(logger logging.Logger, logLevel utils.LogLevelType)

type CustomInvalidParamError

type CustomInvalidParamError struct {
	smithy.InvalidParamError
	// contains filtered or unexported fields
}

CustomInvalidParamError is a custom error type that implements smithy.InvalidParamError

func NewCustomInvalidParamError

func NewCustomInvalidParamError(field, reason string) *CustomInvalidParamError

NewCustomInvalidParamError creates a new CustomInvalidParamError

func (*CustomInvalidParamError) AddNestedContext

func (e *CustomInvalidParamError) AddNestedContext(ctx string)

AddNestedContext adds a nested context to the error

func (*CustomInvalidParamError) Error

func (e *CustomInvalidParamError) Error() string

Error returns the error message

func (*CustomInvalidParamError) Field

func (e *CustomInvalidParamError) Field() string

Field returns the field name

func (*CustomInvalidParamError) SetContext

func (e *CustomInvalidParamError) SetContext(ctx string)

SetContext sets the context for the error

type DaxAPI

type DaxAPI interface {
	PutItemWithOptions(ctx context.Context, input *dynamodb.PutItemInput, output *dynamodb.PutItemOutput, opt RequestOptions) (*dynamodb.PutItemOutput, error)
	DeleteItemWithOptions(ctx context.Context, input *dynamodb.DeleteItemInput, output *dynamodb.DeleteItemOutput, opt RequestOptions) (*dynamodb.DeleteItemOutput, error)
	UpdateItemWithOptions(ctx context.Context, input *dynamodb.UpdateItemInput, output *dynamodb.UpdateItemOutput, opt RequestOptions) (*dynamodb.UpdateItemOutput, error)

	GetItemWithOptions(ctx context.Context, input *dynamodb.GetItemInput, output *dynamodb.GetItemOutput, opt RequestOptions) (*dynamodb.GetItemOutput, error)
	ScanWithOptions(ctx context.Context, input *dynamodb.ScanInput, output *dynamodb.ScanOutput, opt RequestOptions) (*dynamodb.ScanOutput, error)
	QueryWithOptions(ctx context.Context, input *dynamodb.QueryInput, output *dynamodb.QueryOutput, opt RequestOptions) (*dynamodb.QueryOutput, error)

	BatchWriteItemWithOptions(ctx context.Context, input *dynamodb.BatchWriteItemInput, output *dynamodb.BatchWriteItemOutput, opt RequestOptions) (*dynamodb.BatchWriteItemOutput, error)
	BatchGetItemWithOptions(ctx context.Context, input *dynamodb.BatchGetItemInput, output *dynamodb.BatchGetItemOutput, opt RequestOptions) (*dynamodb.BatchGetItemOutput, error)

	TransactWriteItemsWithOptions(ctx context.Context, input *dynamodb.TransactWriteItemsInput, output *dynamodb.TransactWriteItemsOutput, opt RequestOptions) (*dynamodb.TransactWriteItemsOutput, error)
	TransactGetItemsWithOptions(ctx context.Context, input *dynamodb.TransactGetItemsInput, output *dynamodb.TransactGetItemsOutput, opt RequestOptions) (*dynamodb.TransactGetItemsOutput, error)
	// contains filtered or unexported methods
}

type DaxRetryer

type DaxRetryer struct {
	BaseThrottleDelay time.Duration
	MaxBackoffDelay   time.Duration
}

DaxRetryer implements retry strategy with equal jitter backoff for throttled requests

func (DaxRetryer) IsErrorRetryable

func (r DaxRetryer) IsErrorRetryable(err error) bool

IsErrorRetryable returns if the error is daxError if code sequences correct any condition return a value other than unknown.

func (DaxRetryer) MaxAttempts

func (r DaxRetryer) MaxAttempts() int

MaxAttempts returns the maximum number of retry attempts

func (DaxRetryer) RetryDelay

func (r DaxRetryer) RetryDelay(attempts int, err error) time.Duration

RetryDelay returns the delay duration before retrying this request again

type HealthCheckDaxAPI

type HealthCheckDaxAPI interface {
	// contains filtered or unexported methods
}

type HealthStatus

type HealthStatus interface {
	// contains filtered or unexported methods
}

type RequestOptions

type RequestOptions struct {
	dynamodb.Options
	LogLevel   utils.LogLevelType
	RetryDelay time.Duration
	Context    context.Context
	//Retryer implements equal jitter backoff stratergy for throttled requests
	Retryer DaxRetryer
}

type RouteListener

type RouteListener interface {
	// contains filtered or unexported methods
}

type RouteManager

type RouteManager interface {
	// contains filtered or unexported methods
}

type SingleDaxClient

type SingleDaxClient struct {
	// contains filtered or unexported fields
}

func NewSingleClient

func NewSingleClient(endpoint string, connConfigData connConfig, region string, credentials aws.CredentialsProvider, routeListener RouteListener) (*SingleDaxClient, error)

func (*SingleDaxClient) BatchGetItemWithOptions

func (*SingleDaxClient) BatchWriteItemWithOptions

func (*SingleDaxClient) Close

func (client *SingleDaxClient) Close() error

func (*SingleDaxClient) DeleteItemWithOptions

func (client *SingleDaxClient) DeleteItemWithOptions(ctx context.Context, input *dynamodb.DeleteItemInput, output *dynamodb.DeleteItemOutput, opt RequestOptions) (*dynamodb.DeleteItemOutput, error)

func (*SingleDaxClient) GetItemWithOptions

func (client *SingleDaxClient) GetItemWithOptions(ctx context.Context, input *dynamodb.GetItemInput, output *dynamodb.GetItemOutput, opt RequestOptions) (*dynamodb.GetItemOutput, error)

func (*SingleDaxClient) PutItemWithOptions

func (client *SingleDaxClient) PutItemWithOptions(ctx context.Context, input *dynamodb.PutItemInput, output *dynamodb.PutItemOutput, opt RequestOptions) (*dynamodb.PutItemOutput, error)

func (*SingleDaxClient) QueryWithOptions

func (client *SingleDaxClient) QueryWithOptions(ctx context.Context, input *dynamodb.QueryInput, output *dynamodb.QueryOutput, opt RequestOptions) (*dynamodb.QueryOutput, error)

func (*SingleDaxClient) ScanWithOptions

func (client *SingleDaxClient) ScanWithOptions(ctx context.Context, input *dynamodb.ScanInput, output *dynamodb.ScanOutput, opt RequestOptions) (*dynamodb.ScanOutput, error)

func (*SingleDaxClient) TransactGetItemsWithOptions

func (*SingleDaxClient) UpdateItemWithOptions

func (client *SingleDaxClient) UpdateItemWithOptions(ctx context.Context, input *dynamodb.UpdateItemInput, output *dynamodb.UpdateItemOutput, opt RequestOptions) (*dynamodb.UpdateItemOutput, error)

Jump to

Keyboard shortcuts

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