gstreamer
Loading...
Searching...
No Matches
GSROCrate Class Reference

One crate's bounded input queue, ordering buffer, and background processing thread. More...

#include <gSROCrate.h>

Data Structures

class  Impl

Public Types

using ResourceFactory = std::function<GSROCrateResources()>
using DeliveryCallback = std::function<void(GSROEventId, std::uint64_t)>
using FailureCallback = std::function<void(std::exception_ptr)>

Public Member Functions

 GSROCrate (GSROCrateId crate_id, ResourceFactory make_resources, GSROCrateLimits limits={}, DeliveryCallback on_delivery={}, FailureCallback on_failure={})
 ~GSROCrate ()
 GSROCrate (const GSROCrate &)=delete
GSROCrate & operator= (const GSROCrate &)=delete
 GSROCrate (GSROCrate &&)=delete
GSROCrate & operator= (GSROCrate &&)=delete
void enqueue_payload (GSROPayload payload)
 Transfers ownership. Rejects null data, wrong crates, oversized input, and timestamps before a boundary.
void advance_time (GSROTime safe_time)
 Queue a nondecreasing boundary after all earlier input has been submitted. Equality is permitted.
void request_finish (GSROEndContext context)
 Close input and wake producers without joining; permits a service to stop every crate before waiting.
void cancel (std::exception_ptr error)
 Fail input and wake waiters. Cleanup runs on the crate thread after any executing callback returns.
void finish_and_join (GSROEndContext context)
void rethrow_if_failed () const
 Check for a background failure without waiting. Failure also wakes and rejects queued producers.

Detailed Description

Upcoming in the next release. Construction starts the thread; make_resources runs there and returns the sink and the plugin bound to that sink. Their callbacks and destruction also run on that thread. Keep implementation libraries loaded until this object is destroyed.

enqueue_payload and advance_time support concurrent callers. The caller must establish global event delivery before submitting a safe-time boundary; this class does not calculate one. Producers may wait for queue space, but plugin callbacks and output never execute under the queue mutex.

Payloads awaiting a safe boundary have separate limits. Exceeding them fails the crate instead of blocking its consumer and preventing earlier input from arriving. These limits do not bound memory retained inside the implementation plugin; a global admission policy remains a service-level concern.

on_delivery acknowledges retention in the ordering buffer, not plugin processing or durable output. It runs on the crate thread and must not block or call back into this crate. It may notify a future event-delivery tracker. Its exceptions fail the crate just like plugin exceptions. on_failure runs after a background failure, outside the queue mutex. It must not throw, block, or join crate threads. A service may use it to cancel other crates; notification exceptions are suppressed.

The owner must serialize finish_and_join calls and destruction, and keep this object alive until all producers have returned. Callbacks must terminate; joining cannot interrupt a hung plugin or system call.

Definition at line 71 of file gSROCrate.h.

Member Typedef Documentation

◆ DeliveryCallback

using GSROCrate::DeliveryCallback = std::function<void(GSROEventId, std::uint64_t)>

Definition at line 75 of file gSROCrate.h.

◆ FailureCallback

using GSROCrate::FailureCallback = std::function<void(std::exception_ptr)>

Definition at line 76 of file gSROCrate.h.

◆ ResourceFactory

Definition at line 74 of file gSROCrate.h.

Constructor & Destructor Documentation

◆ GSROCrate() [1/3]

GSROCrate::GSROCrate ( GSROCrateId crate_id,
ResourceFactory make_resources,
GSROCrateLimits limits = {},
DeliveryCallback on_delivery = {},
FailureCallback on_failure = {} )

Definition at line 223 of file gSROCrate.cc.

◆ ~GSROCrate()

GSROCrate::~GSROCrate ( )

Definition at line 228 of file gSROCrate.cc.

◆ GSROCrate() [2/3]

GSROCrate::GSROCrate ( const GSROCrate & )
delete

◆ GSROCrate() [3/3]

GSROCrate::GSROCrate ( GSROCrate && )
delete

Member Function Documentation

◆ advance_time()

void GSROCrate::advance_time ( GSROTime safe_time)

Definition at line 234 of file gSROCrate.cc.

◆ cancel()

void GSROCrate::cancel ( std::exception_ptr error)

Definition at line 236 of file gSROCrate.cc.

◆ enqueue_payload()

void GSROCrate::enqueue_payload ( GSROPayload payload)

Definition at line 233 of file gSROCrate.cc.

◆ finish_and_join()

void GSROCrate::finish_and_join ( GSROEndContext context)

Stop accepting input, wake producers, drain, finalize, and join. Repeated calls only recheck errors. A supplied boundary must not precede any submitted boundary; absence preserves the latest one. Pending payloads reach the plugin before finish_run, leaving unfinished-frame policy to it. Rethrows background errors after joining. The destructor instead performs interrupted shutdown and suppresses errors, so explicit finalization is required to observe write/close failures.

Definition at line 237 of file gSROCrate.cc.

◆ operator=() [1/2]

GSROCrate & GSROCrate::operator= ( const GSROCrate & )
delete

◆ operator=() [2/2]

GSROCrate & GSROCrate::operator= ( GSROCrate && )
delete

◆ request_finish()

void GSROCrate::request_finish ( GSROEndContext context)

Definition at line 235 of file gSROCrate.cc.

◆ rethrow_if_failed()

void GSROCrate::rethrow_if_failed ( ) const

Definition at line 238 of file gSROCrate.cc.


The documentation for this class was generated from the following files: