|
gstreamer
|
Shared, run-scoped registry routing worker payloads directly to crate threads. More...
#include <gSROService.h>
Data Structures | |
| class | Impl |
Public Types | |
| using | ResourceFactory = std::function<GSROCrateResources(GSROCrateId)> |
| using | DeliveryCallback = std::function<void(GSROCrateId, GSROEventId, std::uint64_t)> |
Public Member Functions | |
| GSROService () | |
| ~GSROService () | |
| GSROService (const GSROService &)=delete | |
| GSROService & | operator= (const GSROService &)=delete |
| GSROService (GSROService &&)=delete | |
| GSROService & | operator= (GSROService &&)=delete |
| void | begin_run (ResourceFactory make_resources, GSROCrateLimits limits={}, DeliveryCallback on_delivery={}) |
| Begin a fresh invocation after the previous one was joined; clears its progress and failure state. | |
| void | begin_run (ResourceFactory make_resources, std::shared_ptr< const GSROTiming > timing, GSROCrateLimits limits={}, std::size_t max_pending_events=65536) |
| void | create_crate_thread_if_needed (GSROCrateId crate_id) |
| Also permits implementations to request output for empty crates. Concurrent requests create once. | |
| void | dispatch_payload_to_crate (GSROPayload payload) |
| Transfers ownership directly to the destination queue, creating its crate on first use. | |
| void | complete_event (GSROEventId event_id) |
| Automatic mode only. Close once, after all dispatch calls for this event have returned. | |
| void | advance_time (GSROTime safe_time) |
| Manual mode only: broadcast a proven bound after all earlier dispatches return. New crates inherit it. | |
| void | finish_run (GSROEndContext context) |
| void | cancel_run (std::exception_ptr error) |
| Report a worker-side failure and wake blocked producers. The run owner still calls finish_run to join. | |
| void | rethrow_if_failed () const |
Upcoming in the next release. Own this service through a shared_ptr when sharing it across actions. begin_run configures the implementation; no crate threads or files exist until a crate is requested. With a timing model, a metadata-only progress thread broadcasts bounds; payloads bypass that thread. Resource factories execute on their crate threads and must support concurrent calls for different crates. Their captures must keep implementation libraries alive through shutdown.
Creation and dispatch support concurrent workers. Registry locking never spans queue-space waits, plugin calls, or thread joins. A background failure cancels every crate and rejects subsequent input. Explicit finish_run joins all crates before reporting the first failure, even if multiple crates fail.
The run owner serializes begin_run, advance_time, and finish_run. Before beginning another run or destroying the service, it must wait for all producers from the previous run to return. No crate handles escape the service. on_delivery runs on crate threads and must not call back into the service or block.
In automatic mode, workers call complete_event after their last dispatch, including empty events. An event advances the contiguous prefix only once closed and acknowledged by every destination crate. Missing or unfinished events hold progress back; shutdown never silently marks them complete. GSROFactory connects this service to GEMC actions. Finish policies belong to the implementation plugin.
Definition at line 27 of file gSROService.h.
| using GSROService::DeliveryCallback = std::function<void(GSROCrateId, GSROEventId, std::uint64_t)> |
Definition at line 31 of file gSROService.h.
| using GSROService::ResourceFactory = std::function<GSROCrateResources(GSROCrateId)> |
Definition at line 30 of file gSROService.h.
| GSROService::GSROService | ( | ) |
Definition at line 300 of file gSROService.cc.
| GSROService::~GSROService | ( | ) |
Definition at line 301 of file gSROService.cc.
|
delete |
|
delete |
| void GSROService::advance_time | ( | GSROTime | safe_time | ) |
Definition at line 317 of file gSROService.cc.
| void GSROService::begin_run | ( | ResourceFactory | make_resources, |
| GSROCrateLimits | limits = {}, | ||
| DeliveryCallback | on_delivery = {} ) |
Definition at line 305 of file gSROService.cc.
| void GSROService::begin_run | ( | ResourceFactory | make_resources, |
| std::shared_ptr< const GSROTiming > | timing, | ||
| GSROCrateLimits | limits = {}, | ||
| std::size_t | max_pending_events = 65536 ) |
Begin with automatic progress using implementation-defined timing. The timing model must be non-null. max_pending_events bounds bookkeeping when an early event is slow or missing, including empty events. Exceeding it fails the run instead of blocking the worker that might need to complete the missing event. Event IDs start at zero for each invocation; UINT64_MAX is reserved to prevent prefix overflow.
Definition at line 308 of file gSROService.cc.
| void GSROService::cancel_run | ( | std::exception_ptr | error | ) |
Definition at line 321 of file gSROService.cc.
| void GSROService::complete_event | ( | GSROEventId | event_id | ) |
Definition at line 318 of file gSROService.cc.
| void GSROService::create_crate_thread_if_needed | ( | GSROCrateId | crate_id | ) |
Definition at line 313 of file gSROService.cc.
| void GSROService::dispatch_payload_to_crate | ( | GSROPayload | payload | ) |
Definition at line 314 of file gSROService.cc.
| void GSROService::finish_run | ( | GSROEndContext | context | ) |
Close all input queues, drain and join all crates, then rethrow any failure. Repeated calls are safe. In automatic mode, stop/join workers first and leave context.safe_time empty: the service derives it after waiting for accepted deliveries. This finite bound is not the implementation's acquisition end.
Definition at line 319 of file gSROService.cc.
|
delete |
|
delete |
| void GSROService::rethrow_if_failed | ( | ) | const |
Definition at line 320 of file gSROService.cc.