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 ep.ReturnConsumedCapacity ReturnItemCollectionMetrics ep.ReturnItemCollectionMetrics }
func NewBatchWriteItem ¶
func NewBatchWriteItem() *BatchWriteItem
NewBatchWriteItem will return a pointer to an initialized BatchWriteItem struct.
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 (b BatchWriteItem) EndpointReq() (string, int, error)
EndpointReq for BatchGetItem which assumes its BatchWriteItem struct instance `b` conforms to AWS limits. Use this if you do not employ arbitrarily-sized BatchWriteItems and instead choose to conform to the AWS limits.
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.
func (RequestInstance) MarshalJSON ¶
func (r RequestInstance) MarshalJSON() ([]byte, error)
type Response ¶
type Response struct { ConsumedCapacity []ep.ConsumedCapacity ItemCollectionMetrics map[string][]ep.ItemCollectionMetrics UnprocessedItems Table2Requests }
func NewResponse ¶
func NewResponse() *Response
NewResponse will return a pointer to an initialized Response struct.
type Table2Requests ¶
type Table2Requests map[string][]RequestInstance
Table2Requests maps Table names to list of RequestInstances