Documentation ¶
Overview ¶
Support for the DynamoDB BatchWriteItem endpoint. This package offers support for request sizes that exceed AWS limits.
example use:
tests/batch_write_item-livestest.go
Index ¶
Constants ¶
const ( ENDPOINT_NAME = "BatchWriteItem" BATCHWRITE_ENDPOINT = aws_const.ENDPOINT_PREFIX + ENDPOINT_NAME // actual limit is 1024kb QUERY_LIM_BYTES = 1048576 QUERY_LIM = 25 RECURSE_LIM = 50 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchWriteItem ¶
type BatchWriteItem struct { RequestItems Table2Requests ReturnConsumedCapacity string `json:",omitempty"` ReturnItemCollectionMetrics string `json:",omitempty"` }
func NewBatchWriteItem ¶
func NewBatchWriteItem() *BatchWriteItem
func Split ¶
func Split(b *BatchWriteItem) ([]BatchWriteItem, error)
Split supports the ability to have BatchWriteItem structs whose size excceds the stated AWS limits. This function splits an arbitrarily-sized BatchWriteItems into a list of BatchWriteItem structs that are limited to the upper bound stated by AWS.
func (*BatchWriteItem) DoBatchWrite ¶
func (b *BatchWriteItem) DoBatchWrite() (string, int, error)
DoBatchWrite is an endpoint request handler for BatchWriteItem that supports arbitrarily-sized BatchWriteItem struct instances. These are split in a list of conforming BatchWriteItem instances via `Split` and the concurrently dispatched to DynamoDB, with the resulting responses stitched together. May break your provisioning.
func (*BatchWriteItem) EndpointReq ¶
func (batch_write_item *BatchWriteItem) EndpointReq() (string, int, error)
func (*BatchWriteItem) RetryBatchWrite ¶
func (b *BatchWriteItem) RetryBatchWrite(depth int) (string, int, error)
RetryBatchWrite will attempt to fully complete a conforming BatchWriteItem request. Callers for this method should be of len QUERY_LIM or less (see DoBatchWrites()). This is different than EndpointReq in that it will extract UnprocessedKeys and form new BatchWriteItem's based on those, and combine any results.
type DeleteRequest ¶
type PutRequest ¶
type Request ¶
type Request BatchWriteItem
type RequestInstance ¶
type RequestInstance struct { PutRequest *PutRequest DeleteRequest *DeleteRequest }
BatchWriteItem requests can be puts or deletes. The non-nil member of this struct will be the request type specified. Do not specify (non-nil) both in one struct instance.
type Response ¶
type Response struct { ConsumedCapacity []capacity.ConsumedCapacity ItemCollectionMetrics itemcollectionmetrics.ItemCollectionMetricsMap UnprocessedItems Table2Requests }
func NewResponse ¶
func NewResponse() *Response
type Table2Requests ¶
type Table2Requests map[string][]RequestInstance
Table2Requests maps Table names to list of RequestInstances