Skip to content

sgns::processing::ProcessingCoreImpl

Default implementation of ProcessingCore backed by GlobalDB.

#include <processing_core_impl.hpp>

Inherits from sgns::processing::ProcessingCore

Public Types

Name
enum class Error { MAX_NUMBER_SUBTASKS = 1, GLOBALDB_READ_ERROR, NO_BUFFER_FROM_JOB_DATA, TASK_DESERIALIZATION_ERROR, JOB_INCOMPATIBILITY_ERROR, INVALID_MODEL_ERROR}
Error codes for ProcessingCoreImpl operations.

Public Functions

Name
std::shared_ptr< ProcessingCoreImpl > New(std::shared_ptr< ProcessingTaskQueue > task_queue, uint32_t maximalProcessingSubTaskCount, TokenID tokenId, const std::string & developerAddress, uint64_t developerCut)
Factory method to create a new instance of ProcessingCoreImpl.
~ProcessingCoreImpl() =default
virtual outcome::result< SGProcessing::SubTaskResult > ProcessSubTask(const SGProcessing::SubTask & subTask, uint32_t initialHashCode) override
Processes a subtask and returns the result.
virtual float GetProgress() const override
Returns the progress of the processing core as a float between 0.0 and 100.0.

Additional inherited members

Public Functions inherited from sgns::processing::ProcessingCore

Name
virtual ~ProcessingCore() =default

Public Types Documentation

enum Error

Enumerator Value Description
MAX_NUMBER_SUBTASKS 1 Number of subtasks exceeds the configured maximum.
GLOBALDB_READ_ERROR Database read error.
NO_BUFFER_FROM_JOB_DATA No buffer available from job data.
TASK_DESERIALIZATION_ERROR Error occurred while deserializing the task.
JOB_INCOMPATIBILITY_ERROR Job is incompatible with the processing core.
INVALID_MODEL_ERROR The model is invalid.

Error codes for ProcessingCoreImpl operations.

Public Functions Documentation

function New

static std::shared_ptr< ProcessingCoreImpl > New(
    std::shared_ptr< ProcessingTaskQueue > task_queue,
    uint32_t maximalProcessingSubTaskCount,
    TokenID tokenId,
    const std::string & developerAddress,
    uint64_t developerCut
)

Factory method to create a new instance of ProcessingCoreImpl.

Parameters:

  • task_queue A shared pointer to the task queue used for retrieving tasks
  • maximalProcessingSubTaskCount The maximum number of subtasks that can be processed concurrently
  • tokenId The Token ID used on the results
  • developerAddress Payout address of the developer of the app running on this node
  • developerCut The developer's share of each subtask payout, scaled by 1e6

Return: A shared pointer to the created ProcessingCoreImpl instance or nullptr if creation failed

function ~ProcessingCoreImpl

~ProcessingCoreImpl() =default

function ProcessSubTask

virtual outcome::result< SGProcessing::SubTaskResult > ProcessSubTask(
    const SGProcessing::SubTask & subTask,
    uint32_t initialHashCode
) override

Processes a subtask and returns the result.

Parameters:

  • subTask The subtask to process
  • initialHashCode An initial hash code that can be used for processing

Return: The result of processing the subtask, or failure if processing failed

Reimplements: sgns::processing::ProcessingCore::ProcessSubTask

function GetProgress

virtual float GetProgress() const override

Returns the progress of the processing core as a float between 0.0 and 100.0.

Return: The percentage of the processing of the subtask

Reimplements: sgns::processing::ProcessingCore::GetProgress


Updated on 2026-08-28 at 22:24:30 +0000