durable-execution - v0.32.0
    Preparing search index...

    Class TaskExecutionsStorageWithMutex

    Wraps a TaskExecutionsStorage and makes all operations atomic by protecting them with a mutex. Only use this if the underlying storage is not atomic.

    Implements

    Index

    Constructors

    Methods

    • Get many task executions by sleeping task unique id.

      Parameters

      • requests: readonly { sleepingTaskUniqueId: string }[]

        The requests to get the task executions.

      Returns Promise<(undefined | TaskExecutionStorageValue)[]>

      The task executions.

    • Update task executions by status and start at less than and return the task executions that were updated. The task executions are ordered by startAt ascending.

      Update expiresAt = updateExpiresAtWithStartedAt + existingTaskExecution.timeoutMs.

      Parameters

      • request: {
            status: TaskExecutionStatus;
            startAtLessThan: number;
            update: TaskExecutionStorageUpdate;
            updateExpiresAtWithStartedAt: number;
            limit: number;
        }

        The request to update the task executions.

        • status: TaskExecutionStatus

          The status of the task executions to update.

        • startAtLessThan: number

          The start at less than of the task executions to update.

        • update: TaskExecutionStorageUpdate

          The update object.

        • updateExpiresAtWithStartedAt: number

          The startedAt value to update the expires at with.

        • limit: number

          The maximum number of task executions to update.

      Returns Promise<TaskExecutionStorageValue[]>

      The task executions that were updated.

    • Update task executions by is sleeping task and expires at less than and return the number of task executions that were updated. The task executions are ordered by expiresAt ascending.

      Parameters

      • request: {
            status: TaskExecutionStatus;
            isSleepingTask: boolean;
            expiresAtLessThan: number;
            update: TaskExecutionStorageUpdate;
            limit: number;
        }

        The request to update the task executions.

        • status: TaskExecutionStatus

          The status of the task executions to update.

        • isSleepingTask: boolean

          The is sleeping task of the task executions to update.

        • expiresAtLessThan: number

          The expires at less than of the task executions to update.

        • update: TaskExecutionStorageUpdate

          The update object.

        • limit: number

          The maximum number of task executions to update.

      Returns Promise<number>

      The number of task executions that were updated.

    • Update task executions by on children finished processing expires at less than and return the number of task executions that were updated. The task executions are ordered by onChildrenFinishedProcessingExpiresAt ascending.

      Parameters

      • request: {
            onChildrenFinishedProcessingExpiresAtLessThan: number;
            update: TaskExecutionStorageUpdate;
            limit: number;
        }

        The request to update the task executions.

        • onChildrenFinishedProcessingExpiresAtLessThan: number

          The on children finished processing expires at less than of the task executions to update.

        • update: TaskExecutionStorageUpdate

          The update object.

        • limit: number

          The maximum number of task executions to update.

      Returns Promise<number>

      The number of task executions that were updated.

    • Update task executions by close expires at less than and return the number of task executions that were updated. The task executions are ordered by closeExpiresAt ascending.

      Parameters

      • request: {
            closeExpiresAtLessThan: number;
            update: TaskExecutionStorageUpdate;
            limit: number;
        }

        The request to update the task executions.

        • closeExpiresAtLessThan: number

          The close expires at less than of the task executions to update.

        • update: TaskExecutionStorageUpdate

          The update object.

        • limit: number

          The maximum number of task executions to update.

      Returns Promise<number>

      The task executions that were updated.

    • Update task executions by executor id and needs promise cancellation. The task executions are ordered by updatedAt ascending.

      Parameters

      • request: {
            executorId: string;
            needsPromiseCancellation: boolean;
            update: TaskExecutionStorageUpdate;
            limit: number;
        }

        The request to update the task executions.

        • executorId: string

          The id of the executor.

        • needsPromiseCancellation: boolean

          The needs promise cancellation of the task executions to update.

        • update: TaskExecutionStorageUpdate

          The update object.

        • limit: number

          The maximum number of task executions to update.

      Returns Promise<TaskExecutionStorageValue[]>

      The task executions that were updated.

    • Get many task executions by parent execution id.

      Parameters

      • requests: readonly { parentExecutionId: string }[]

        The requests to get the task executions.

      Returns Promise<TaskExecutionStorageValue[][]>

      The task executions.

    • Update many task executions by parent execution id and is finished. Each request should be atomic.

      Parameters

      • requests: readonly {
            parentExecutionId: string;
            isFinished: boolean;
            update: TaskExecutionStorageUpdate;
        }[]

        The requests to update the task executions.

      Returns Promise<void>

    • Update task executions by is finished and close status. Also, decrement parent active children count for all these task executions atomically along with the update. The task executions are ordered by updatedAt ascending.

      Parameters

      Returns Promise<number>

      The number of task executions that were updated.

    • Delete task execution by id. This is used for testing. Ideally the storage implementation should have a test and production mode and this method should be a no-op in production.

      Parameters

      • request: { executionId: string }

        The request to delete the task execution.

        • executionId: string

          The id of the task execution to delete.

      Returns Promise<void>

    • Delete all task executions. This is used for testing. Ideally the storage implementation should have a test and production mode and this method should be a no-op in production.

      Returns Promise<void>