Skip to main content
Version: v1

ITaskManager Interface

Task manager interface

Signature

export interface ITaskManager extends ISharedObject<ITaskManagerEvents>

Extends: ISharedObject<ITaskManagerEvents

Methods

Method Return Type Description
abandon(taskId) void Exit the queue, releasing the task if currently locked.
haveTaskLock(taskId) boolean Check whether this client is the current assignee for the task and there is no outstanding abandon op that would release the lock.
lockTask(taskId) Promise<void> Try to lock the task. Promise resolves when the lock is acquired, or rejects if we are removed from the queue without acquiring the lock for any reason.
queued(taskId) boolean Check whether this client is either the current assignee for the task or is waiting in line or we expect they will be in line after outstanding ops have been ack'd.

Method Details

abandon

Exit the queue, releasing the task if currently locked.

Signature

abandon(taskId: string): void;

Parameters

Parameter Type Description
taskId string Identifier for the task

haveTaskLock

Check whether this client is the current assignee for the task and there is no outstanding abandon op that would release the lock.

Signature

haveTaskLock(taskId: string): boolean;

Parameters

Parameter Type Description
taskId string Identifier for the task

Returns

Return type: boolean

lockTask

Try to lock the task. Promise resolves when the lock is acquired, or rejects if we are removed from the queue without acquiring the lock for any reason.

Signature

lockTask(taskId: string): Promise<void>;

Parameters

Parameter Type Description
taskId string Identifier for the task

Returns

Return type: Promise<void>

queued

Check whether this client is either the current assignee for the task or is waiting in line or we expect they will be in line after outstanding ops have been ack'd.

Signature

queued(taskId: string): boolean;

Parameters

Parameter Type Description
taskId string Identifier for the task

Returns

Return type: boolean