Options
All
  • Public
  • Public/Protected
  • All
Menu

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

  • BatchOperation<Record<string, AttributeValue>>
    • BatchGet

Index

Constructors

constructor

  • Parameters

    • client: DynamoDBClient

      The AWS SDK client with which to communicate with DynamoDB.

    • items: SyncOrAsyncIterable<[string, Record<string, AttributeValue>]>

      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.

    • options: BatchGetOptions = {}

      Additional options to apply to the operations executed.

    Returns BatchGet

Properties

Protected Readonly batchSize

batchSize: 100 = MAX_READ_BATCH_SIZE

Protected Readonly client

client: DynamoDBClient

Protected Readonly pending

pending: [string, Record<string, AttributeValue>][] = []

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

Protected Readonly state

state: BatchState<Record<string, AttributeValue>> = {}

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

Protected Readonly toSend

toSend: [string, Record<string, AttributeValue>][] = []

Input elements that are prepared for immediate dispatch

Methods

[asyncIterator]

Protected doBatchRequest

  • doBatchRequest(): Promise<void>
  • Returns Promise<void>

Protected getInitialTableState

  • getInitialTableState(tableName: string): TableState<Record<string, AttributeValue>>
  • Parameters

    • tableName: string

    Returns TableState<Record<string, AttributeValue>>

Protected handleThrottled

  • handleThrottled(tableName: string, unprocessed: Record<string, AttributeValue>[]): 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: Record<string, AttributeValue>[]

      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, Record<string, AttributeValue>], any>>
  • Returns Promise<IteratorResult<[string, Record<string, AttributeValue>], any>>