Type alias AdminBlockingOptions

AdminBlockingOptions: PollBlockingOptions | NoBlockingOptions

The options representing the blocking behavior of many admin operations.

Said operations are typically require polling to determine completion. They may or may not be extremely long-running, depending on the operation, but they are not instantaneous.

The default behavior is to block until the operation is complete, with a pollInterval determined on a method-by-method basis, but able to be overridden.

Otherwise, it can be made "non-blocking" by setting blocking to false, where it's up to the caller to determine when the operation is complete.

Example

// Will block by default until the operation is complete.
const dbAdmin1 = await admin.createDatabase({...});

// Will not block until the operation is complete.
// Still returned an AstraDbAdmin object, but it's not very useful
// until the operation completes.
const dbAdmin2 = await admin.createDatabase({...}, {
  blocking: false,
});

// Blocks with a custom poll interval (per 5s).
const dbAdmin3 = await admin.createDatabase({...}, {
  blocking: true,
  pollInterval: 5000,
});

Remarks

By "blocking", we mean that the operation will not return until the operation is complete, which is determined by polling the operation at a regular interval. "Non-blocking" means that the operation makes the initial request, but then returns immediately, leaving it up to the caller to determine when the operation is complete.

If it's chosen not to block, keep in mind that the objects that the operation returns may not be fully usable, or even usable at all, until the operation is complete. createDatabase, for example, returns an AstraDbAdmin object, but there's no initialized database for it to work on until the database is fully created.

Field

blocking - Whether to block the operation until it is complete.

Field

pollInterval - The interval at which to poll the operation for completion.