Skip to content

sgns::sgprocessing::ProcessingManager

#include <ProcessingManager.hpp>

Public Types

Name
enum class Error

Public Functions

Name
~ProcessingManager()
outcome::result< uint64_t > ParseBlockSize() const
outcome::result< void > CheckProcessValidity()
outcome::result< ProcessOutput > Process(std::shared_ptr< boost::asio::io_context > ioc, std::vector< std::vector< uint8_t > > & chunkhashes, sgns::ModelNode & model, std::vector< std::string > & output_locations)
outcome::result< ProcessOutput > Process(std::shared_ptr< boost::asio::io_context > ioc, std::vector< std::vector< uint8_t > > & chunkhashes, sgns::ModelNode & model, std::vector< std::string > & output_locations, ExecutionContext & externalExecCtx)
void CanExecute(const sgns::Pass & pass, sgns::sgprocessing::CanExecuteCallback callback)
void RegisterProcessorFactory(const int & name, std::function< std::unique_ptr< ProcessingProcessor >()> factoryFunction)
void RegisterPassProcessorFactory(PassType type, std::function< std::unique_ptr< ProcessingProcessor >()> factoryFunction, bool supportsCheckpointing =false)
sgns::SgnsProcessing GetProcessingData()
outcome::result< size_t > GetInputIndex(const std::string & input) const
float GetProgress() const
const ExecutionManifest & GetLastManifest() const
outcome::result< std::shared_ptr< ProcessingManager > > Create(const std::string & jsondata)
bool IsProcessingValid(const std::string & jsondata)
Checks whether a processing json is valid by attempting to create a ProcessingManager instance with it.
bool IsProcessingModelValid(const std::string & jsondata)
Checks if a json encoded data contains a valid ModelNode structure by attempting to parse it.
outcome::result< sgns::ModelNode > GetModelNodeFromJson(const std::string & jsondata)
Gets the ModelNode structure parsed from a json string.

Public Types Documentation

enum Error

Enumerator Value Description
PROCESS_INFO_MISSING 1
INVALID_JSON 2
INVALID_BLOCK_PARAMETERS 3
NO_PROCESSOR 4
MISSING_INPUT 5
INPUT_UNAVAIL 6
SHADER_COMPILE_FAILED 7
SPIRV_VALIDATION_FAILED 8
PROCESSING_FAILED 9
MODEL_MISSING 10
MODEL_FORMAT_UNSUPPORTED 11
RENDER_SHADER_MISSING 12
UNKNOWN_PASS_TYPE 13

Public Functions Documentation

function ~ProcessingManager

~ProcessingManager()

function ParseBlockSize

outcome::result< uint64_t > ParseBlockSize() const

function CheckProcessValidity

outcome::result< void > CheckProcessValidity()

function Process

outcome::result< ProcessOutput > Process(
    std::shared_ptr< boost::asio::io_context > ioc,
    std::vector< std::vector< uint8_t > > & chunkhashes,
    sgns::ModelNode & model,
    std::vector< std::string > & output_locations
)

function Process

outcome::result< ProcessOutput > Process(
    std::shared_ptr< boost::asio::io_context > ioc,
    std::vector< std::vector< uint8_t > > & chunkhashes,
    sgns::ModelNode & model,
    std::vector< std::string > & output_locations,
    ExecutionContext & externalExecCtx
)

Parameters:

  • ioc — Boost.Asio io_context used for IPFS/file IO
  • chunkhashes — chunk hashes for the input data
  • model — model node describing the input source
  • output_locations — populated with save locations for produced outputs
  • externalExecCtx — caller-owned ExecutionContext; not copied or reset

Process() overload accepting a caller-owned ExecutionContext (Gap 2 / TEST-07). Lets a caller cancel mid-execution via externalExecCtx.cancelToken.Cancel() from another thread, or pre-set deadlineMs/gpuMemoryBudget/ maxOutputArtifactBytes before calling. Per-pass schema-derived budgets are still applied as defaults, but only when the corresponding field is still 0 (unset) on entry — an explicit caller-supplied nonzero value is never overwritten. Delegates to the same ProcessInternal() implementation as the legacy 4-arg overload above, so behavior is otherwise identical.

function CanExecute

void CanExecute(
    const sgns::Pass & pass,
    sgns::sgprocessing::CanExecuteCallback callback
)

Parameters:

  • pass — the job pass definition to validate
  • callback — invoked with CanExecuteResult

Pre-execution capability gate (D-02, D-19). Validates whether this node can execute the given pass — checks PassType registration, Vulkan limits, MNN model compatibility, GPU memory, and disk space against the cached startup snapshot. Caller's responsibility to call this before Process(); Process() trusts the caller validated.

function RegisterProcessorFactory

inline void RegisterProcessorFactory(
    const int & name,
    std::function< std::unique_ptr< ProcessingProcessor >()> factoryFunction
)

Parameters:

  • name - DataType cast to int
  • factoryFunction - Pointer to processor

Register an available processor keyed by DataType

function RegisterPassProcessorFactory

inline void RegisterPassProcessorFactory(
    PassType type,
    std::function< std::unique_ptr< ProcessingProcessor >()> factoryFunction,
    bool supportsCheckpointing =false
)

Parameters:

  • type - PassType enum
  • factoryFunction - Pointer to processor
  • supportsCheckpointing - Whether this executor supports checkpoint/resume (D-20)

Register an available processor keyed by PassType

function GetProcessingData

sgns::SgnsProcessing GetProcessingData()

Get Processing Data item which can be used to access any processing data, inputs, or params.

function GetInputIndex

outcome::result< size_t > GetInputIndex(
    const std::string & input
) const

Get input map Index

function GetProgress

inline float GetProgress() const

Return: Progress percentage (0.0 to 100.0)

Get current processing progress

function GetLastManifest

inline const ExecutionManifest & GetLastManifest() const

Return: Reference to the most recently produced ExecutionManifest.

Get the manifest produced by the most recent Process() call (ARTF-09). Populated on every terminal state — success or failure (CANCELLED, TIMED_OUT, BUDGET_EXCEEDED, generic error) — so a caller holding only a ProcessingManager instance can retrieve a human-readable errorMessage without access to the original ProcessingError or processor internals.

function Create

static outcome::result< std::shared_ptr< ProcessingManager > > Create(
    const std::string & jsondata
)

function IsProcessingValid

static bool IsProcessingValid(
    const std::string & jsondata
)

Checks whether a processing json is valid by attempting to create a ProcessingManager instance with it.

Parameters:

  • jsondata JSON string containing the processing data to validate.

Return: True if the processing is valid and a ProcessingManager instance can be created, false otherwise.

function IsProcessingModelValid

static bool IsProcessingModelValid(
    const std::string & jsondata
)

Checks if a json encoded data contains a valid ModelNode structure by attempting to parse it.

Parameters:

  • jsondata JSON string containing the ModelNode data to validate.

Return: True if the json can be parsed into a ModelNode, false otherwise.

function GetModelNodeFromJson

static outcome::result< sgns::ModelNode > GetModelNodeFromJson(
    const std::string & jsondata
)

Gets the ModelNode structure parsed from a json string.

Parameters:

  • jsondata JSON string containing the ModelNode data to parse

Return: The ModelNode parsed from the json string, or an error if the json is invalid or the ModelNode structure cannot be parsed.


Updated on 2026-09-17 at 06:29:14 +0000