client

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

A stub implementation of the DaxAPI interface that can be configured to return a series of responses to BatchGetItem, Query, and Scan requests. It is used to test pagination logic.

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"
)
View Source
const (
	OpGetItem            = "GetItem"
	OpPutItem            = "PutItem"
	OpUpdateItem         = "UpdateItem"
	OpDeleteItem         = "DeleteItem"
	OpBatchGetItem       = "BatchGetItem"
	OpBatchWriteItem     = "BatchWriteItem"
	OpTransactGetItems   = "TransactGetItems"
	OpTransactWriteItems = "TransactWriteItems"
	OpQuery              = "Query"
	OpScan               = "Scan"
)

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(c aws.Config, isRequestConfig bool) error

func ValidateHandlers

func ValidateHandlers(h request.Handlers, expectDaxHandlers bool) error

func ValidateRequest

func ValidateRequest(r *request.Request) error

Types

type ClientStub added in v1.2.2

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

func NewClientStub added in v1.2.2

func NewClientStub(batchGetItemResponses []*dynamodb.BatchGetItemOutput, queryResponses []*dynamodb.QueryOutput, scanResponses []*dynamodb.ScanOutput) *ClientStub

Constructor

func (*ClientStub) BatchGetItemWithOptions added in v1.2.2

func (stub *ClientStub) BatchGetItemWithOptions(input *dynamodb.BatchGetItemInput, output *dynamodb.BatchGetItemOutput, opt RequestOptions) (*dynamodb.BatchGetItemOutput, error)

func (*ClientStub) BatchWriteItemWithOptions added in v1.2.2

func (stub *ClientStub) BatchWriteItemWithOptions(input *dynamodb.BatchWriteItemInput, output *dynamodb.BatchWriteItemOutput, opt RequestOptions) (*dynamodb.BatchWriteItemOutput, error)

func (*ClientStub) DeleteItemWithOptions added in v1.2.2

func (stub *ClientStub) DeleteItemWithOptions(input *dynamodb.DeleteItemInput, output *dynamodb.DeleteItemOutput, opt RequestOptions) (*dynamodb.DeleteItemOutput, error)

func (*ClientStub) GetBatchGetItemRequests added in v1.2.2

func (stub *ClientStub) GetBatchGetItemRequests() []*dynamodb.BatchGetItemInput

Stub methods

func (*ClientStub) GetItemWithOptions added in v1.2.2

func (stub *ClientStub) GetItemWithOptions(input *dynamodb.GetItemInput, output *dynamodb.GetItemOutput, opt RequestOptions) (*dynamodb.GetItemOutput, error)

func (*ClientStub) GetQueryRequests added in v1.2.2

func (stub *ClientStub) GetQueryRequests() []*dynamodb.QueryInput

func (*ClientStub) GetScanRequests added in v1.2.2

func (stub *ClientStub) GetScanRequests() []*dynamodb.ScanInput

func (*ClientStub) NewDaxRequest added in v1.2.2

func (stub *ClientStub) NewDaxRequest(op *request.Operation, input, output interface{}, opt RequestOptions) *request.Request

func (*ClientStub) PutItemWithOptions added in v1.2.2

func (stub *ClientStub) PutItemWithOptions(input *dynamodb.PutItemInput, output *dynamodb.PutItemOutput, opt RequestOptions) (*dynamodb.PutItemOutput, error)

DaxAPI methods

func (*ClientStub) QueryWithOptions added in v1.2.2

func (stub *ClientStub) QueryWithOptions(input *dynamodb.QueryInput, output *dynamodb.QueryOutput, opt RequestOptions) (*dynamodb.QueryOutput, error)

func (*ClientStub) ScanWithOptions added in v1.2.2

func (stub *ClientStub) ScanWithOptions(input *dynamodb.ScanInput, output *dynamodb.ScanOutput, opt RequestOptions) (*dynamodb.ScanOutput, error)

func (*ClientStub) TransactGetItemsWithOptions added in v1.2.2

func (*ClientStub) TransactWriteItemsWithOptions added in v1.2.2

func (*ClientStub) UpdateItemWithOptions added in v1.2.2

func (stub *ClientStub) UpdateItemWithOptions(input *dynamodb.UpdateItemInput, output *dynamodb.UpdateItemOutput, opt RequestOptions) (*dynamodb.UpdateItemOutput, error)

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 (cc *ClusterDaxClient) GetItemWithOptions(input *dynamodb.GetItemInput, output *dynamodb.GetItemOutput, opt RequestOptions) (*dynamodb.GetItemOutput, error)

func (*ClusterDaxClient) NewDaxRequest

func (cc *ClusterDaxClient) NewDaxRequest(op *request.Operation, input, output interface{}, opt RequestOptions) *request.Request

func (*ClusterDaxClient) PutItemWithOptions

func (cc *ClusterDaxClient) PutItemWithOptions(input *dynamodb.PutItemInput, output *dynamodb.PutItemOutput, opt RequestOptions) (*dynamodb.PutItemOutput, error)

func (*ClusterDaxClient) QueryWithOptions

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

func (*ClusterDaxClient) ScanWithOptions

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

func (*ClusterDaxClient) TransactGetItemsWithOptions added in v1.1.0

func (*ClusterDaxClient) TransactWriteItemsWithOptions added in v1.1.0

func (*ClusterDaxClient) UpdateItemWithOptions

type Config

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

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

func DefaultConfig

func DefaultConfig() Config

type DaxAPI

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

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

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

	TransactWriteItemsWithOptions(input *dynamodb.TransactWriteItemsInput, output *dynamodb.TransactWriteItemsOutput, opt RequestOptions) (*dynamodb.TransactWriteItemsOutput, error)
	TransactGetItemsWithOptions(input *dynamodb.TransactGetItemsInput, output *dynamodb.TransactGetItemsOutput, opt RequestOptions) (*dynamodb.TransactGetItemsOutput, error)

	NewDaxRequest(op *request.Operation, input, output interface{}, opt RequestOptions) *request.Request
	// contains filtered or unexported methods
}

type DaxRetryer added in v1.1.5

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

DaxRetryer implements EqualJitterBackoffStratergy for throttled requests

func (DaxRetryer) MaxRetries added in v1.1.5

func (r DaxRetryer) MaxRetries() int

MaxRetries returns the number of maximum retries the service will use to make an individual API request.

func (DaxRetryer) RetryRules added in v1.1.5

func (r DaxRetryer) RetryRules(req *request.Request) time.Duration

RetryRules returns the delay duration before retrying this request again

func (DaxRetryer) ShouldRetry added in v1.1.5

func (r DaxRetryer) ShouldRetry(req *request.Request) bool

ShouldRetry returns true if the request should be retried.

type RequestOptions

type RequestOptions struct {
	LogLevel aws.LogLevelType
	Logger   aws.Logger

	RetryDelay time.Duration
	//Retryer implements equal jitter backoff stratergy for throttled requests
	Retryer    DaxRetryer
	MaxRetries int
	//SleepDelayFn is used for non-throttled retryable requests
	SleepDelayFn func(time.Duration)
	Context      aws.Context
}

func (*RequestOptions) MergeFromRequestOptions

func (o *RequestOptions) MergeFromRequestOptions(ctx aws.Context, opts ...request.Option) error

type SingleDaxClient

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

func NewSingleClient

func NewSingleClient(endpoint, region string, credentials *credentials.Credentials) (*SingleDaxClient, error)

func (*SingleDaxClient) BatchGetItemWithOptions

func (client *SingleDaxClient) BatchGetItemWithOptions(input *dynamodb.BatchGetItemInput, output *dynamodb.BatchGetItemOutput, opt RequestOptions) (*dynamodb.BatchGetItemOutput, error)

func (*SingleDaxClient) BatchWriteItemWithOptions

func (*SingleDaxClient) Close

func (client *SingleDaxClient) Close() error

func (*SingleDaxClient) DeleteItemWithOptions

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

func (*SingleDaxClient) GetItemWithOptions

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

func (*SingleDaxClient) NewDaxRequest

func (client *SingleDaxClient) NewDaxRequest(op *request.Operation, input, output interface{}, opt RequestOptions) *request.Request

func (*SingleDaxClient) PutItemWithOptions

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

func (*SingleDaxClient) QueryWithOptions

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

func (*SingleDaxClient) ScanWithOptions

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

func (*SingleDaxClient) TransactGetItemsWithOptions added in v1.1.0

func (*SingleDaxClient) TransactWriteItemsWithOptions added in v1.1.0

func (*SingleDaxClient) UpdateItemWithOptions

func (client *SingleDaxClient) UpdateItemWithOptions(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