@chip/cstd - v0.0.8
    Preparing search index...

    Interface AsyncQueue<T, K>

    interface AsyncQueue<T, K> {
        checkedOut: () => Promise<Record<string, number>>;
        complete: (job: CompletedJob<T, K>, worker: string) => Promise<void>;
        completedCount: () => Promise<number>;
        pop: (worker: string) => Promise<Job<T> | undefined>;
        push: (job: Job<T>) => Promise<void>;
        requeue: (worker: string) => Promise<void>;
        requeueAll: () => Promise<void>;
        scores: () => Promise<Record<string, number>>;
        toDoCount: () => Promise<number>;
    }

    Type Parameters

    • T
    • K
    Index

    Properties

    checkedOut: () => Promise<Record<string, number>>

    Get the number of jobs checked out to each worker.

    complete: (job: CompletedJob<T, K>, worker: string) => Promise<void>

    Mark a job as completed.

    Type Declaration

      • (job: CompletedJob<T, K>, worker: string): Promise<void>
      • Parameters

        • job: CompletedJob<T, K>

          Completed job item, including the result and success status.

        • worker: string

          Worker name/identifier to credit.

        Returns Promise<void>

    completedCount: () => Promise<number>
    pop: (worker: string) => Promise<Job<T> | undefined>

    Pop a job off the queue for the given worker.

    Type Declaration

      • (worker: string): Promise<Job<T> | undefined>
      • Parameters

        • worker: string

          The worker name/identifier.

        Returns Promise<Job<T> | undefined>

        Job or undefined if no job is available.

    push: (job: Job<T>) => Promise<void>

    Push a job onto the queue.

    requeue: (worker: string) => Promise<void>

    Requeue all jobs for a given worker.

    requeueAll: () => Promise<void>

    Requeue all jobs for all workers.

    scores: () => Promise<Record<string, number>>

    Get the scores for all workers.

    Type Declaration

      • (): Promise<Record<string, number>>
      • Returns Promise<Record<string, number>>

        A record of worker names and their respective scores.

    toDoCount: () => Promise<number>