Skip to content

sgns::processing::ProcessingTaskQueue

#include <processing_task_queue.hpp>

Inherited by sgns::processing::TaskQueueImpl

Public Functions

Name
virtual ~ProcessingTaskQueue() =default
Distributed task queue interface.
outcome::result< void > EnqueueTask(const SGProcessing::Task & task, const std::list< SGProcessing::SubTask > & subTasks)
Stores a task with its subtasks.
virtual outcome::result< void > EnqueueTask(const SGProcessing::Task & task, const std::list< SGProcessing::SubTask > & subTasks, std::shared_ptr< crdt::AtomicTransaction > crdt_transaction) =0
Stores a task with its subtasks within an atomic transaction.
virtual outcome::result< SGProcessing::Task > GetTask(const std::string & taskId) =0
Returns a task by task id, returns failure if task not found or invalid.
virtual bool GetSubTasks(const std::string & taskId, std::list< SGProcessing::SubTask > & subTasks) =0
Retrieves the subtasks for a given task ID.
virtual outcome::result< std::pair< std::string, SGProcessing::Task > > GrabTask() =0
Grabs task from the storage, returning its ID and data.
virtual outcome::result< std::shared_ptr< crdt::AtomicTransaction > > CompleteTask(const std::string & taskId, const SGProcessing::TaskResult & result) =0
Completes a task with its result returning an atomic transaction to commit the completion.
virtual bool IsTaskCompleted(const std::string & taskId) =0
Checks if the task is completed.
virtual void MarkTaskBad(const std::string & taskKey) =0
Mark a task key as bad to be skipped.

Public Functions Documentation

function ~ProcessingTaskQueue

virtual ~ProcessingTaskQueue() =default

Distributed task queue interface.

Provides enqueue, retrieval, and completion tracking for tasks and their subtasks.

function EnqueueTask

inline outcome::result< void > EnqueueTask(
    const SGProcessing::Task & task,
    const std::list< SGProcessing::SubTask > & subTasks
)

Stores a task with its subtasks.

Parameters:

  • task The task to store
  • subTasks The subtasks to store

Return: Success if the task and subtasks were stored successfully, failure otherwise

function EnqueueTask

virtual outcome::result< void > EnqueueTask(
    const SGProcessing::Task & task,
    const std::list< SGProcessing::SubTask > & subTasks,
    std::shared_ptr< crdt::AtomicTransaction > crdt_transaction
) =0

Stores a task with its subtasks within an atomic transaction.

Parameters:

  • task The task to store
  • subTasks The subtasks to store
  • crdt_transaction The atomic transaction to use

Return: Success if the task and subtasks were stored successfully, failure otherwise

Reimplemented by: sgns::processing::TaskQueueImpl::EnqueueTask

function GetTask

virtual outcome::result< SGProcessing::Task > GetTask(
    const std::string & taskId
) =0

Returns a task by task id, returns failure if task not found or invalid.

Parameters:

  • taskId the ID of the task

Return: The task if found, failure otherwise

Reimplemented by: sgns::processing::TaskQueueImpl::GetTask

function GetSubTasks

virtual bool GetSubTasks(
    const std::string & taskId,
    std::list< SGProcessing::SubTask > & subTasks
) =0

Retrieves the subtasks for a given task ID.

Parameters:

  • taskId The ID of the task for which to retrieve subtasks.
  • subTasks A reference to a list where the retrieved subtasks will be stored.

Return: true if the subtasks were retrieved successfully, false otherwise.

Reimplemented by: sgns::processing::TaskQueueImpl::GetSubTasks

function GrabTask

virtual outcome::result< std::pair< std::string, SGProcessing::Task > > GrabTask() =0

Grabs task from the storage, returning its ID and data.

Return: A pair of task ID and task data if a task is found, failure otherwise.

Reimplemented by: sgns::processing::TaskQueueImpl::GrabTask

function CompleteTask

virtual outcome::result< std::shared_ptr< crdt::AtomicTransaction > > CompleteTask(
    const std::string & taskId,
    const SGProcessing::TaskResult & result
) =0

Completes a task with its result returning an atomic transaction to commit the completion.

Parameters:

  • taskId The ID of the task to complete
  • result The result of the completed task

Return: A CRDT atomic transaction if the task completion was successful, failure otherwise

Reimplemented by: sgns::processing::TaskQueueImpl::CompleteTask

function IsTaskCompleted

virtual bool IsTaskCompleted(
    const std::string & taskId
) =0

Checks if the task is completed.

Parameters:

  • taskId Task id.

Return: true if the task is completed, false otherwise.

Reimplemented by: sgns::processing::TaskQueueImpl::IsTaskCompleted

function MarkTaskBad

virtual void MarkTaskBad(
    const std::string & taskKey
) =0

Mark a task key as bad to be skipped.

Parameters:

  • taskKey Task key to mark as bad.

Reimplemented by: sgns::processing::TaskQueueImpl::MarkTaskBad


Updated on 2026-06-05 at 17:22:18 -0700