ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
reusex::pipeline Namespace Reference

Classes

struct  JobEvent
 One notification about a job. More...
struct  JobRecord
 A job as reported by the runner. Snapshot; never a live view. More...
class  JobRunner
 FIFO, single-worker, in-process pipeline job runner. More...
struct  JobRunnerOptions
 Tuning knobs for the job store. More...
struct  ParameterDescriptor
 One knob of one stage. More...
struct  StageArtifact
 One artifact a stage wrote, so a client can refresh exactly what changed instead of re-fetching everything. More...
struct  StageContext
 Everything a stage execution needs, independent of any HTTP/CLI front end. More...
struct  StageResult
 Outcome of one stage execution. More...

Typedefs

using JobListener = std::function<void(const JobEvent &)>
 Listener callback.
using WriterLease = std::unique_lock<std::timed_mutex>
 Exclusive right to write to a runner's project.
using ParameterDefault
 The default a parameter takes when the key is absent from the job's parameters object.
using StageExecutor = std::function<StageResult(const StageContext &)>
 Stage execution strategy.

Enumerations

enum class  JobStatus {
  queued , running , succeeded , failed ,
  cancelled
}
 Lifecycle of a submitted job. More...
enum class  ParameterType {
  number , integer , boolean , string ,
  integer_list
}
 Wire type of a stage parameter, i.e. what JSON a caller should send. More...
enum class  JobStage { clouds , planes , rooms , instances }
 A pipeline stage that can be executed as a job. More...

Functions

std::string_view to_string (JobStatus status)
 Canonical lower-case status name used on the wire.
std::optional< JobStatusparse_job_status (std::string_view name)
 Parse a canonical status name. Returns nullopt for an unknown name.
bool is_terminal (JobStatus status)
 True for statuses a job can never leave.
std::string iso8601_utc_now ()
 UTC timestamp in ISO-8601 form (e.g. "2026-09-08T11:22:33Z").
std::string_view to_string (JobEvent::Type type)
 Canonical lower-case event-type name used on the wire.
std::string_view to_string (ParameterType type)
 Canonical lower-case token for type, as it appears on the wire.
const std::vector< ParameterDescriptor > & stage_parameters (JobStage stage)
 Every parameter stage recognises, in form-display order.
std::string_view to_string (JobStage stage)
 Canonical lower-case stage name (the token used on the wire and the CLI).
std::string_view pipeline_log_name (JobStage stage)
 The name this stage writes into pipeline_log.stage.
std::optional< JobStageparse_job_stage (std::string_view name)
 Parse a canonical stage name. Returns nullopt for an unknown name.
std::vector< std::string > job_stage_names ()
 Every name accepted by parse_job_stage(), in pipeline order.
bool stage_supports_cancellation (JobStage stage)
 True when the stage threads the cancel token into its inner loop, i.e.
StageResult run_stage (ProjectDB &db, const StageContext &ctx)
 Run a stage against an already-open, writable ProjectDB.
StageResult run_stage (const StageContext &ctx)
 Open ctx.project read-write and run the stage against it.
StageExecutor default_stage_executor ()
 The executor that actually runs the pipeline (a thin wrap of run_stage).

Variables

constexpr std::string_view kDefaultSemanticCloud = "labels"
 Name of the semantic-label cloud instances reads when the job does not say otherwise.
constexpr std::string_view kDefaultInstanceCloud = "instances"
 Name of the cloud instances writes when the job does not say otherwise.

Typedef Documentation

◆ JobListener

using reusex::pipeline::JobListener = std::function<void(const JobEvent &)>

Listener callback.

Invoked on the worker (or submitting) thread with no runner lock held; implementations must be thread-safe and must not block.

Definition at line 129 of file JobRunner.hpp.

◆ ParameterDefault

Initial value:
std::variant<std::monostate, double, long long, bool, std::string>

The default a parameter takes when the key is absent from the job's parameters object.

monostate means "no scalar default" — the parameter is absent-by-default and has no neutral value to pre-fill a form with (planes.filter, instances.labels).

Definition at line 53 of file stage_parameters.hpp.

◆ StageExecutor

using reusex::pipeline::StageExecutor = std::function<StageResult(const StageContext &)>

Stage execution strategy.

Exists so JobRunner's state machine can be tested against a fake executor without touching real scan data.

Definition at line 144 of file stages.hpp.

◆ WriterLease

using reusex::pipeline::WriterLease = std::unique_lock<std::timed_mutex>

Exclusive right to write to a runner's project.

Empty (!lease.owns_lock()) when the lock could not be taken in time. Releases on destruction, so a handler simply keeps it alive for as long as its ProjectDB write handle is open.

Definition at line 136 of file JobRunner.hpp.

Enumeration Type Documentation

◆ JobStage

enum class reusex::pipeline::JobStage
strong

A pipeline stage that can be executed as a job.

Deliberately narrower than core::PipelineStage (which also covers stages with no runner yet) and than core::Stage (which is a progress-reporting phase, not a unit of work). Extending this enum is how a stage becomes GUI-runnable; see docs/gui/openapi.yaml, which lists the same names.

Enumerator
clouds 

back-project sensor frames into "cloud" + "normals"

planes 

detect planar surfaces -> "planes"/"plane_*"

rooms 

partition planes into rooms -> "rooms"

instances 

split semantic labels into spatial instances

Definition at line 42 of file stages.hpp.

◆ JobStatus

enum class reusex::pipeline::JobStatus
strong

Lifecycle of a submitted job.

queued ──▶ running ──▶ succeeded │ ├──────▶ failed │ └──────▶ cancelled └──────────────────▶ cancelled (cancelled before it ever started)

Enumerator
queued 
running 
succeeded 
failed 
cancelled 

Definition at line 53 of file JobRunner.hpp.

◆ ParameterType

Wire type of a stage parameter, i.e. what JSON a caller should send.

Enumerator
number 

JSON number, fractional (float in the option struct).

integer 

JSON number, integral.

boolean 

JSON true/false.

string 

JSON string.

integer_list 

JSON array of non-negative integers.

Definition at line 38 of file stage_parameters.hpp.

Function Documentation

◆ default_stage_executor()

StageExecutor reusex::pipeline::default_stage_executor ( )

The executor that actually runs the pipeline (a thin wrap of run_stage).

References default_stage_executor().

Referenced by default_stage_executor().

◆ is_terminal()

bool reusex::pipeline::is_terminal ( JobStatus status)

True for statuses a job can never leave.

◆ iso8601_utc_now()

std::string reusex::pipeline::iso8601_utc_now ( )

UTC timestamp in ISO-8601 form (e.g. "2026-09-08T11:22:33Z").

◆ job_stage_names()

std::vector< std::string > reusex::pipeline::job_stage_names ( )

Every name accepted by parse_job_stage(), in pipeline order.

◆ parse_job_stage()

std::optional< JobStage > reusex::pipeline::parse_job_stage ( std::string_view name)

Parse a canonical stage name. Returns nullopt for an unknown name.

◆ parse_job_status()

std::optional< JobStatus > reusex::pipeline::parse_job_status ( std::string_view name)

Parse a canonical status name. Returns nullopt for an unknown name.

◆ pipeline_log_name()

std::string_view reusex::pipeline::pipeline_log_name ( JobStage stage)

The name this stage writes into pipeline_log.stage.

Deliberately NOT the same as to_string(): the CLI has been writing segment_planes / cloud_reconstruction into that column since long before the GUI existed, and existing project databases are full of those values. The wire token stays short (planes); the log name stays compatible, so one table does not end up with two names for one operation.

◆ run_stage() [1/2]

StageResult reusex::pipeline::run_stage ( const StageContext & ctx)

Open ctx.project read-write and run the stage against it.

References run_stage().

◆ run_stage() [2/2]

StageResult reusex::pipeline::run_stage ( ProjectDB & db,
const StageContext & ctx )

Run a stage against an already-open, writable ProjectDB.

Never throws: algorithm/IO failures are converted into a failed StageResult and, when a pipeline_log row was opened, closed out with the error message (STANDARDS §5 — no silent failure).

References run_stage().

Referenced by run_stage(), and run_stage().

◆ stage_parameters()

const std::vector< ParameterDescriptor > & reusex::pipeline::stage_parameters ( JobStage stage)

Every parameter stage recognises, in form-display order.

◆ stage_supports_cancellation()

bool reusex::pipeline::stage_supports_cancellation ( JobStage stage)

True when the stage threads the cancel token into its inner loop, i.e.

cancellation takes effect mid-run rather than only between jobs.

◆ to_string() [1/4]

std::string_view reusex::pipeline::to_string ( JobEvent::Type type)

Canonical lower-case event-type name used on the wire.

◆ to_string() [2/4]

std::string_view reusex::pipeline::to_string ( JobStage stage)

Canonical lower-case stage name (the token used on the wire and the CLI).

◆ to_string() [3/4]

std::string_view reusex::pipeline::to_string ( JobStatus status)

Canonical lower-case status name used on the wire.

◆ to_string() [4/4]

std::string_view reusex::pipeline::to_string ( ParameterType type)

Canonical lower-case token for type, as it appears on the wire.

Variable Documentation

◆ kDefaultInstanceCloud

std::string_view reusex::pipeline::kDefaultInstanceCloud = "instances"
inlineconstexpr

Name of the cloud instances writes when the job does not say otherwise.

Definition at line 88 of file stage_parameters.hpp.

◆ kDefaultSemanticCloud

std::string_view reusex::pipeline::kDefaultSemanticCloud = "labels"
inlineconstexpr

Name of the semantic-label cloud instances reads when the job does not say otherwise.

Shared with run_instances() so the descriptor's default and the runner's fallback cannot drift apart.

Definition at line 86 of file stage_parameters.hpp.