batch_get_item

package
v0.0.0-...-93ed684 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2014 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Support for the DynamoDB BatchGetItem endpoint. This package offers support for request sizes that exceed AWS limits.

example use:

tests/batch_get_item-livestest.go

Index

Constants

View Source
const (
	ENDPOINT_NAME     = "BatchGetItem"
	BATCHGET_ENDPOINT = aws_const.ENDPOINT_PREFIX + ENDPOINT_NAME
	// actual limit is 1024kb
	QUERY_LIM_BYTES = 1048576
	QUERY_LIM       = 100
	RECURSE_LIM     = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchGetItem

type BatchGetItem struct {
	RequestItems           Table2Requests
	ReturnConsumedCapacity string `json:",omitempty"`
}

func NewBatchGetItem

func NewBatchGetItem() *BatchGetItem

func Split

func Split(b *BatchGetItem) ([]BatchGetItem, error)

Split supports the ability to have BatchGetItem structs whose size excceds the stated AWS limits. This function splits an arbitrarily-sized BatchGetItems into a list of BatchGetItem structs that are limited to the upper bound stated by AWS.

func (*BatchGetItem) DoBatchGet

func (b *BatchGetItem) DoBatchGet() (string, int, error)

DoBatchGet is an endpoint request handler for BatchGetItem that supports arbitrarily-sized BatchGetItem struct instances. These are split in a list of conforming BatchGetItem instances via `Split` and the concurrently dispatched to DynamoDB, with the resulting responses stitched together. May break your provisioning.

func (*BatchGetItem) EndpointReq

func (batch_get_item *BatchGetItem) EndpointReq() (string, int, error)

func (*BatchGetItem) RetryBatchGet

func (b *BatchGetItem) RetryBatchGet(depth int) (string, int, error)

RetryBatchGet will attempt to fully complete a conforming BatchGetItem request. Callers for this method should be of len QUERY_LIM or less (see DoBatchGets()). This is different than EndpointReq in that it will extract UnprocessedKeys and form new BatchGetItem's based on those, and combine any results.

type Request

type Request BatchGetItem

func (*Request) EndpointReq

func (req *Request) EndpointReq() (string, int, error)

type RequestInstance

type RequestInstance struct {
	AttributesToGet          attributestoget.AttributesToGet                   `json:",omitempty"`
	ConsistentRead           bool                                              `json:",omitempty"`
	ExpressionAttributeNames expressionattributenames.ExpressionAttributeNames `json:",omitempty"`
	Keys                     []item.Item
	ProjectionExpression     string `json:",omitempty"`
}

RequestInstance indicates what Keys to retrieve for a Table.

func NewRequestInstance

func NewRequestInstance() *RequestInstance

type Response

type Response struct {
	ConsumedCapacity []capacity.ConsumedCapacity
	Responses        map[string][]item.Item
	UnprocessedKeys  Table2Requests
}

func NewResponse

func NewResponse() *Response

type Table2Requests

type Table2Requests map[string]*RequestInstance

Table2Requests maps Table names to Key and Attribute data to retrieve.

Jump to

Keyboard shortcuts

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