Skip to main content

Interface: StorageDriverLimiter<Item>

common.StorageDriverLimiter

Bounds how many external storage operations all drivers managed by a single ExternalStorage instance may have in flight at once. This limit is cooperative which means driver implementations must use the provided context.limiter to acquire permits for each operation.

This limit can be configured via ExternalStorageConcurrency.maxDriverOperations.

n.b. taking permits from inside another permit can lead to deadlocks if the nesting exceeds the configured concurrency limit. It is up to the driver to determine what a single "operation" looks like.

Type parameters

Name
Item

Methods

permit

permit<T>(item, operation): Promise<T>

Runs operation once a permit for item is available, releasing the permit when it settles.

Type parameters

Name
T

Parameters

NameType
itemItem
operation() => Promise<T>

Returns

Promise<T>