v0.0.0-...-1f046af Latest Latest

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

Go to latest
Published: Jun 15, 2015 License: BSD-2-Clause Imports: 12 Imported by: 0



Support for the DynamoDB BatchWriteItem endpoint. This package offers support for request sizes that exceed AWS limits.

example use:




View Source
const (
	ENDPOINT_NAME       = "BatchWriteItem"
	// actual limit is 1024kb
	QUERY_LIM_BYTES = 1048576
	QUERY_LIM       = 25
	RECURSE_LIM     = 50


This section is empty.


This section is empty.


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

func (b *BatchWriteItem) DoBatchWriteWithConf(c *conf.AWS_Conf) ([]byte, int, error)

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 (batch_write_item *BatchWriteItem) EndpointReqWithConf(c *conf.AWS_Conf) ([]byte, int, error)

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

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

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 DeleteRequest struct {
	Key item.Item

type PutRequest

type PutRequest struct {
	Item item.Item

type PutRequestItemJSON

type PutRequestItemJSON struct {
	Item interface{}

type Request

type Request BatchWriteItem

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 {
	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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL