pub struct AeronArchivePersistentSubscription { /* private fields */ }Implementations§
Source§impl AeronArchivePersistentSubscription
impl AeronArchivePersistentSubscription
Sourcepub fn new_zeroed_on_heap() -> Self
pub fn new_zeroed_on_heap() -> Self
creates zeroed struct where the underlying c struct is on the heap
Sourcepub fn new_zeroed_on_stack() -> Self
pub fn new_zeroed_on_stack() -> Self
creates zeroed struct where the underlying c struct is on the stack (Use with care)
Sourcepub fn poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>(
&self,
handler: Option<&Handler<AeronFragmentHandlerHandlerImpl>>,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn poll<AeronFragmentHandlerHandlerImpl: AeronFragmentHandlerCallback>( &self, handler: Option<&Handler<AeronFragmentHandlerHandlerImpl>>, fragment_limit: usize, ) -> Result<i32, AeronCError>
Poll a persistent subscription for available messages.
Delivers assembled messages to the handler, so the handler shouldn’t be a fragment assembler.
§Parameters
-
handlerfor handling read messages. -
clientdto pass to the handler. -
fragment_limitmaximum number of message fragments to read when polling.
§Return
positive number if fragments have been read or the persistent subscription has done other work, 0 if no fragments have been read and no work has been done, negative on error.
Sourcepub fn poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader)>(
&self,
handler: AeronFragmentHandlerHandlerImpl,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn poll_fn<AeronFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader)>( &self, handler: AeronFragmentHandlerHandlerImpl, fragment_limit: usize, ) -> Result<i32, AeronCError>
Poll a persistent subscription for available messages.
Delivers assembled messages to the handler, so the handler shouldn’t be a fragment assembler.
§Parameters
-
handlerfor handling read messages. -
clientdto pass to the handler. -
fragment_limitmaximum number of message fragments to read when polling.
§Return
positive number if fragments have been read or the persistent subscription has done other work, 0 if no fragments have been read and no work has been done, negative on error.
Stack-borrowed closure (_fn variant): the FnMut closure lives on the
caller’s stack and is borrowed for this call only — the callback fires
synchronously inside the call, so nothing is heap-allocated, nothing is stored,
and the closure may borrow local state. Prefer this over the retained
Handler-based form on the hot path; only generated for callbacks the C
client does not retain (i.e. not stored for later firing).
§Panics
A panic inside the closure cannot unwind across the extern "C" callback
boundary and aborts the process (since Rust 1.81). Return early instead
of panicking in production fragment handlers.
Sourcepub fn controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>(
&self,
handler: Option<&Handler<AeronControlledFragmentHandlerHandlerImpl>>,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn controlled_poll<AeronControlledFragmentHandlerHandlerImpl: AeronControlledFragmentHandlerCallback>( &self, handler: Option<&Handler<AeronControlledFragmentHandlerHandlerImpl>>, fragment_limit: usize, ) -> Result<i32, AeronCError>
Poll in a controlled manner a persistent subscription for available messages.
Delivers assembled messages to the handler, so the handler shouldn’t be a fragment assembler.
§Parameters
-
handlerfor handling read messages. -
clientdto pass to the handler. -
fragment_limitmaximum number of message fragments to read when polling.
§Return
positive number if fragments have been read or the persistent subscription has done other work, 0 if no fragments have been read and no work has been done, negative on error.
Sourcepub fn controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader) -> aeron_controlled_fragment_handler_action_t>(
&self,
handler: AeronControlledFragmentHandlerHandlerImpl,
fragment_limit: usize,
) -> Result<i32, AeronCError>
pub fn controlled_poll_fn<AeronControlledFragmentHandlerHandlerImpl: FnMut(&[u8], AeronHeader) -> aeron_controlled_fragment_handler_action_t>( &self, handler: AeronControlledFragmentHandlerHandlerImpl, fragment_limit: usize, ) -> Result<i32, AeronCError>
Poll in a controlled manner a persistent subscription for available messages.
Delivers assembled messages to the handler, so the handler shouldn’t be a fragment assembler.
§Parameters
-
handlerfor handling read messages. -
clientdto pass to the handler. -
fragment_limitmaximum number of message fragments to read when polling.
§Return
positive number if fragments have been read or the persistent subscription has done other work, 0 if no fragments have been read and no work has been done, negative on error.
Stack-borrowed closure (_fn variant): the FnMut closure lives on the
caller’s stack and is borrowed for this call only — the callback fires
synchronously inside the call, so nothing is heap-allocated, nothing is stored,
and the closure may borrow local state. Prefer this over the retained
Handler-based form on the hot path; only generated for callbacks the C
client does not retain (i.e. not stored for later firing).
§Panics
A panic inside the closure cannot unwind across the extern "C" callback
boundary and aborts the process (since Rust 1.81). Return early instead
of panicking in production fragment handlers.
Sourcepub fn is_live(&self) -> bool
pub fn is_live(&self) -> bool
Check if persistent subscription is live, i.e. reading messages from the live subscription without having a replay subscription.
§Return
true if live, false otherwise.
Sourcepub fn is_replaying(&self) -> bool
pub fn is_replaying(&self) -> bool
Indicates if the persistent subscription is replaying from a recording.
§Return
true if replaying, false otherwise.
Sourcepub fn has_failed(&self) -> bool
pub fn has_failed(&self) -> bool
Indicates if the persistent subscription has failed.
The listener will be notified of any terminal errors that can cause the persistent subscription to fail.
§Return
true if failed, false otherwise. @see aeron_archive_persistent_subscription_context_set_listener
Sourcepub fn failure_reason(
&self,
out_errcode: &mut c_int,
out_message: *mut *const c_char,
) -> bool
pub fn failure_reason( &self, out_errcode: &mut c_int, out_message: *mut *const c_char, ) -> bool
Get the terminal error that caused the persistent subscription to fail. Only meaningful when aeron_archive_persistent_subscription_has_failed returns true.
§Parameters
-
out_errcodeoptional pointer to receive the error code, may be NULL. -
out_messageoptional pointer to receive the error message, may be NULL.
§Return
true if in the failed state, false otherwise. @see aeron_archive_persistent_subscription_has_failed
pub fn get_inner(&self) -> *mut aeron_archive_persistent_subscription_t
Sourcepub unsafe fn get_inner_mut(
&self,
) -> &mut aeron_archive_persistent_subscription_t
pub unsafe fn get_inner_mut( &self, ) -> &mut aeron_archive_persistent_subscription_t
Mutable access to the underlying C struct, minted from &self: nothing
prevents two live &mut at once, so the caller must ensure exclusive
access for the lifetime of the returned reference.
§Safety
No other reference (& or &mut) to the underlying struct may be
alive while the returned &mut is in use.
pub fn get_inner_ref(&self) -> &aeron_archive_persistent_subscription_t
Source§impl AeronArchivePersistentSubscription
impl AeronArchivePersistentSubscription
Sourcepub fn close(self) -> Result<(), AeronCError>
pub fn close(self) -> Result<(), AeronCError>
Closes this resource in the C client immediately; all clones of this handle become closed (their pointer is nulled) and must not be used.
Source§impl AeronArchivePersistentSubscription
Safe creation method for AeronArchivePersistentSubscription
impl AeronArchivePersistentSubscription
Safe creation method for AeronArchivePersistentSubscription
Sourcepub fn create(
ctx: AeronArchivePersistentSubscriptionContext,
listener: Option<Box<dyn PersistentSubscriptionListener>>,
) -> Result<Self, AeronCError>
pub fn create( ctx: AeronArchivePersistentSubscriptionContext, listener: Option<Box<dyn PersistentSubscriptionListener>>, ) -> Result<Self, AeronCError>
Create a persistent subscription from a context.
If listener is Some, it is wired into the context (the C layer copies
the callback pointers + clientd) and kept alive for the subscription’s
lifetime; it is freed once the subscription is closed.
The context is consumed and owned by the subscription from this point on — it will be closed when the subscription is closed, so it must not be used afterwards.
Sourcepub fn get_failure_reason(&self) -> Option<(i32, String)>
pub fn get_failure_reason(&self) -> Option<(i32, String)>
Get the failure reason as a tuple of (error_code, error_message). Returns None if there is no failure. This is a safe wrapper around the C function.
Trait Implementations§
Source§impl Clone for AeronArchivePersistentSubscription
impl Clone for AeronArchivePersistentSubscription
Source§fn clone(&self) -> AeronArchivePersistentSubscription
fn clone(&self) -> AeronArchivePersistentSubscription
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ControlledFragmentAssemblable for AeronArchivePersistentSubscription
Controlled-poll counterpart for AeronControlledFragmentClosureAssembler.
impl ControlledFragmentAssemblable for AeronArchivePersistentSubscription
Controlled-poll counterpart for AeronControlledFragmentClosureAssembler.
fn controlled_poll_with_assembler( &self, assembler: Option<&Handler<AeronControlledFragmentAssembler>>, fragment_limit: usize, ) -> Result<i32, AeronCError>
Source§impl FragmentAssemblable for AeronArchivePersistentSubscription
Route a persistent subscription through AeronFragmentClosureAssembler for
API consistency with AeronSubscription. Note: the C
aeron_archive_persistent_subscription_poll already reassembles fragments
internally (via aeron_image_fragment_assembler_handler), so the delegate
receives whole messages either way — the Rust assembler here is a pass-through.
Prefer ps.poll_fn(handler, limit) directly unless you want the shared API.
impl FragmentAssemblable for AeronArchivePersistentSubscription
Route a persistent subscription through AeronFragmentClosureAssembler for
API consistency with AeronSubscription. Note: the C
aeron_archive_persistent_subscription_poll already reassembles fragments
internally (via aeron_image_fragment_assembler_handler), so the delegate
receives whole messages either way — the Rust assembler here is a pass-through.
Prefer ps.poll_fn(handler, limit) directly unless you want the shared API.