20 std::vector<uint8_t> data,
25 , send_fn_(std::
move(send_fn))
26 , on_complete_(std::
move(on_complete))
27 , on_error_(std::
move(on_error)) {
33 std::chrono::duration_cast<std::chrono::nanoseconds>(
34 std::chrono::steady_clock::now().time_since_epoch()
45 on_error_(context_.session_id,
"Empty data to send");
48 "Empty data to send");
53 on_error_(context_.session_id,
"No send function provided");
56 "No send function provided");
60 auto result = send_fn_(context_.session_id,
data_);
62 if (!result.is_ok()) {
64 auto err = result.error();
65 on_error_(context_.session_id, err.message);
68 on_complete_(context_.session_id,
false, 0);
75 on_complete_(context_.session_id,
true,
data_.size());
90 return "send_network_io_job[session=" +
92 ", bytes=" + std::to_string(
data_.size()) +
"]";
96 -> const std::vector<uint8_t>& {
Coordinates the 6-stage DICOM I/O pipeline.
send_network_io_job(uint64_t session_id, std::vector< uint8_t > data, send_function send_fn, completion_callback on_complete=nullptr, error_callback on_error=nullptr)
Construct a send job.
auto get_data() const noexcept -> const std::vector< uint8_t > &
Get the data to send.
std::function< void(uint64_t session_id, bool success, size_t bytes_sent)> completion_callback
Callback type for send completion.
auto get_name() const -> std::string override
Get the job name.
auto execute(pipeline_coordinator &coordinator) -> VoidResult override
Execute the send job.
std::function< void(uint64_t session_id, const std::string &error)> error_callback
Callback type for send errors.
std::vector< uint8_t > data_
std::function< VoidResult(uint64_t session_id, const std::vector< uint8_t > &data)> send_function
Function type for actual network send operation.
auto get_session_id() const noexcept -> uint64_t
Get the session ID.
auto get_context() const noexcept -> const job_context &override
Get the job context.
@ move
C-MOVE move request/response.
@ other
Unknown or other category.
@ network_send
Stage 6: Send PDU bytes to network.
kcenon::pacs::VoidResult VoidResult
VoidResult type alias for operations without return value.
VoidResult pacs_void_error(int code, const std::string &message, const std::string &details="")
Create a PACS void error result.
Network I/O send job for Stage 6 of the pipeline.
Context information attached to pipeline jobs for tracking.
pipeline_stage stage
Current pipeline stage.
job_category category
Job category for metrics.
uint64_t enqueue_time_ns
Timestamp when job entered the pipeline (nanoseconds since epoch)
uint64_t session_id
Session/association identifier.