Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BatchGet

Retrieves items from DynamoDB in batches of 100 or fewer via one or more BatchGetItem operations. The items may be from any number of tables.

This method will automatically retry any get requests returned by DynamoDB as unprocessed. Exponential backoff on unprocessed items is employed on a per-table basis.

Hierarchy

Implements

  • AsyncIterableIterator<[string, AttributeMap]>

Index

Constructors

constructor

  • Parameters

    • client: DynamoDB

      The AWS SDK client with which to communicate with DynamoDB.

    • items: SyncOrAsyncIterable<[string, AttributeMap]>

      A synchronous or asynchronous iterable of tuples describing the reads to execute. The first member of the tuple should be the name of the table from which to read, and the second should be the marshalled key.

    • Default value __namedParameters: object = {}

    Returns BatchGet

Properties

Protected batchSize

batchSize: 100 = MAX_READ_BATCH_SIZE

Protected client

client: DynamoDB

The AWS SDK client with which to communicate with DynamoDB.

Protected pending

pending: Array<[string, AttributeMap]> = []

Items that have been retrieved and are ready to be returned.

Protected state

state: BatchState<AttributeMap>

A mapping of table names to table-specific operation state (e.g., the number of throttling events experienced, etc.)

Protected toSend

toSend: Array<[string, AttributeMap]> = []

Input elements that are prepared for immediate dispatch

Methods

__@asyncIterator

  • __@asyncIterator(): this

Protected doBatchRequest

  • doBatchRequest(): Promise<void>

Protected getInitialTableState

  • getInitialTableState(tableName: string): TableState<AttributeMap>

Protected handleThrottled

  • handleThrottled(tableName: string, unprocessed: Array<AttributeMap>): void
  • Accept an array of unprocessed items belonging to a single table and re-enqueue it for submission, making sure the appropriate level of backoff is applied to future operations on the same table.

    Parameters

    • tableName: string

      The table to which the unprocessed elements belong.

    • unprocessed: Array<AttributeMap>

      Elements returned by DynamoDB as not yet processed. The elements should not be unmarshalled, but they should be reverted to the form used for elements that have not yet been sent.

    Returns void

Protected movePendingToThrottled

  • movePendingToThrottled(unprocessedTables: Set<string>): void
  • Iterate over all pending writes and move those targeting throttled tables into the throttled queue.

    Parameters

    • unprocessedTables: Set<string>

      A set of tables for which some items were returned without being processed.

    Returns void

next

  • next(): Promise<IteratorResult<[string, AttributeMap]>>