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
- type BatchWriteItem
- func (b *BatchWriteItem) DoBatchWrite() ([]byte, int, error)
- func (b *BatchWriteItem) DoBatchWriteWithConf(c *conf.AWS_Conf) ([]byte, int, error)
- func (batch_write_item *BatchWriteItem) EndpointReq() ([]byte, int, error)
- func (batch_write_item *BatchWriteItem) EndpointReqWithConf(c *conf.AWS_Conf) ([]byte, int, error)
- func (b *BatchWriteItem) RetryBatchWrite(depth int) ([]byte, int, error)
- func (b *BatchWriteItem) RetryBatchWriteWithConf(depth int, c *conf.AWS_Conf) ([]byte, int, error)
- type BatchWriteItemJSON
- type DeleteRequest
- type PutRequest
- type PutRequestItemJSON
- type Request
- type RequestInstance
- type RequestInstanceItemJSON
- type Response
- type Table2Requests
- type Table2RequestsItemsJSON
Constants ¶
const ( ENDPOINT_NAME = "BatchWriteItem" JSON_ENDPOINT_NAME = ENDPOINT_NAME + "JSON" 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() ([]byte, int, error)
DoBatchWrite calls DoBatchWriteWithConf using the global conf.
func (*BatchWriteItem) DoBatchWriteWithConf ¶
DoBatchWriteWithConf 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() ([]byte, int, error)
func (*BatchWriteItem) EndpointReqWithConf ¶
func (*BatchWriteItem) RetryBatchWrite ¶
func (b *BatchWriteItem) RetryBatchWrite(depth int) ([]byte, int, error)
RetryBatchWrite is just a wrapper for RetryBatchWriteWithConf using the global conf.
func (*BatchWriteItem) RetryBatchWriteWithConf ¶
RetryBatchWriteWithConf 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 BatchWriteItemJSON ¶
type BatchWriteItemJSON struct { RequestItems Table2RequestsItemsJSON ReturnConsumedCapacity string `json:",omitempty"` ReturnItemCollectionMetrics string `json:",omitempty"` }
func NewBatchWriteItemJSON ¶
func NewBatchWriteItemJSON() *BatchWriteItemJSON
func (*BatchWriteItemJSON) ToBatchWriteItem ¶
func (bwij *BatchWriteItemJSON) ToBatchWriteItem() (*BatchWriteItem, error)
ToBatchWriteItem will attempt to convert a BatchWriteItemJSON to BatchWriteItem
type DeleteRequest ¶
type PutRequest ¶
type PutRequestItemJSON ¶
type PutRequestItemJSON struct {
Item interface{}
}
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 RequestInstanceItemJSON ¶
type RequestInstanceItemJSON struct { PutRequest *PutRequestItemJSON DeleteRequest *DeleteRequest }
Similar, but supporting the use of basic json for put requests. Note that use of basic json is only supported for Items, whereas delete requests use keys.
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
type Table2RequestsItemsJSON ¶
type Table2RequestsItemsJSON map[string][]RequestInstanceItemJSON