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 ¶
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 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() ([]byte, int, error)
func (*BatchGetItem) RetryBatchGet ¶
func (b *BatchGetItem) RetryBatchGet(depth int) ([]byte, 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
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.