batch_write_item

package
Version: v0.0.0-...-1bb5a49 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2014 License: BSD-2-Clause Imports: 11 Imported by: 0

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

View Source
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() (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 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() (string, 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
t or T : Toggle theme light dark auto
y or Y : Canonical URL