batch_get_item

package
v0.0.0-...-1f046af Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: BSD-2-Clause Imports: 13 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"
	JSON_ENDPOINT_NAME = ENDPOINT_NAME + "JSON"
	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() ([]byte, int, error)

DoBatchGet calls DoBatchGetWithConf using the global conf.

func (*BatchGetItem) DoBatchGetWithConf

func (b *BatchGetItem) DoBatchGetWithConf(c *conf.AWS_Conf) ([]byte, 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(c *conf.AWS_Conf) ([]byte, int, error)

func (*BatchGetItem) EndpointReqWithConf

func (batch_get_item *BatchGetItem) EndpointReqWithConf(c *conf.AWS_Conf) ([]byte, int, error)

func (*BatchGetItem) RetryBatchGet

func (b *BatchGetItem) RetryBatchGet(depth int) ([]byte, int, error)

RetryBatchGet is just a wrapper for RetryBatchGetWithConf using the global conf.

func (*BatchGetItem) RetryBatchGetWithConf

func (b *BatchGetItem) RetryBatchGetWithConf(depth int, c *conf.AWS_Conf) ([]byte, int, error)

RetryBatchGetWithConf 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() ([]byte, int, error)

func (*Request) EndpointReqWithConf

func (req *Request) EndpointReqWithConf(c *conf.AWS_Conf) ([]byte, 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 `json:",omitempty"`
	Responses        map[string][]item.Item
	UnprocessedKeys  Table2Requests
}

func NewResponse

func NewResponse() *Response

func (*Response) ToResponseItemsJSON

func (resp *Response) ToResponseItemsJSON() (*ResponseItemsJSON, error)

ToResponseItemsJSON will try to convert the Response to a ResponsesItemsJSON, where the interface value for Item represents a structure that can be marshaled into basic JSON.

type ResponseItemsJSON

type ResponseItemsJSON struct {
	ConsumedCapacity []capacity.ConsumedCapacity `json:",omitempty"`
	Responses        map[string][]interface{}
	UnprocessedKeys  Table2Requests
}

func NewResponseItemsJSON

func NewResponseItemsJSON() *ResponseItemsJSON

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