Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BatchOperation<Element>

Type parameters

Hierarchy

Implements

  • AsyncIterableIterator<[string, Element]>

Index

Constructors

constructor

  • Parameters

    • client: DynamoDB

      The AWS SDK client with which to communicate with DynamoDB.

    • items: SyncOrAsyncIterable<[string, Element]>

      A synchronous or asynchronous iterable of tuples describing the operations to execute. The first member of the tuple should be the name of the table targeted by the operation.

    Returns BatchOperation

Properties

Protected Abstract batchSize

batchSize: number

The maximum number of elements that may be included in a single batch.

Protected client

client: DynamoDB

The AWS SDK client with which to communicate with DynamoDB.

Protected pending

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

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

Protected state

state: BatchState<Element>

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

Protected toSend

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

Input elements that are prepared for immediate dispatch

Methods

__@asyncIterator

  • __@asyncIterator(): this

Protected Abstract doBatchRequest

  • doBatchRequest(): Promise<void>
  • Execute a single batch request and process the result.

    Returns Promise<void>

Protected getInitialTableState

  • getInitialTableState(tableName: string): TableState<Element>
  • Create and return the initial state object for a given DynamoDB table.

    Parameters

    • tableName: string

      The name of the table whose initial state should be returned.

    Returns TableState<Element>

Protected handleThrottled

  • handleThrottled(tableName: string, unprocessed: Array<Element>): 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<Element>

      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, Element]>>