Skip to main content

AeronArchivePersistentSubscription

Struct AeronArchivePersistentSubscription 

Source
pub struct AeronArchivePersistentSubscription { /* private fields */ }

Implementations§

Source§

impl AeronArchivePersistentSubscription

Source

pub fn new_zeroed_on_heap() -> Self

creates zeroed struct where the underlying c struct is on the heap

Source

pub fn new_zeroed_on_stack() -> Self

creates zeroed struct where the underlying c struct is on the stack (Use with care)

Source

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
  • handler for handling read messages.

  • clientd to pass to the handler.

  • fragment_limit maximum 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.

Source

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
  • handler for handling read messages.

  • clientd to pass to the handler.

  • fragment_limit maximum 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.

Source

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
  • handler for handling read messages.

  • clientd to pass to the handler.

  • fragment_limit maximum 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.

Source

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
  • handler for handling read messages.

  • clientd to pass to the handler.

  • fragment_limit maximum 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.

Source

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.

Source

pub fn is_replaying(&self) -> bool

Indicates if the persistent subscription is replaying from a recording.

§Return

true if replaying, false otherwise.

Source

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

Source

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_errcode optional pointer to receive the error code, may be NULL.

  • out_message optional 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

Source

pub fn get_inner(&self) -> *mut aeron_archive_persistent_subscription_t

Source

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.

Source

pub fn get_inner_ref(&self) -> &aeron_archive_persistent_subscription_t

Source§

impl AeronArchivePersistentSubscription

Source

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

Source

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.

Source

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

Source§

fn clone(&self) -> AeronArchivePersistentSubscription

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ControlledFragmentAssemblable for AeronArchivePersistentSubscription

Controlled-poll counterpart for AeronControlledFragmentClosureAssembler.

Source§

impl Debug for AeronArchivePersistentSubscription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for AeronArchivePersistentSubscription

Source§

type Target = aeron_archive_persistent_subscription_stct

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
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.

Source§

impl From<&AeronArchivePersistentSubscription> for *mut aeron_archive_persistent_subscription_t

Source§

fn from(value: &AeronArchivePersistentSubscription) -> Self

Converts to this type from the input type.
Source§

impl From<*const aeron_archive_persistent_subscription_stct> for AeronArchivePersistentSubscription

Source§

fn from(value: *const aeron_archive_persistent_subscription_t) -> Self

Converts to this type from the input type.
Source§

impl From<*mut aeron_archive_persistent_subscription_stct> for AeronArchivePersistentSubscription

Source§

fn from(value: *mut aeron_archive_persistent_subscription_t) -> Self

Converts to this type from the input type.
Source§

impl From<AeronArchivePersistentSubscription> for *mut aeron_archive_persistent_subscription_t

Source§

fn from(value: AeronArchivePersistentSubscription) -> Self

Converts to this type from the input type.
Source§

impl From<AeronArchivePersistentSubscription> for aeron_archive_persistent_subscription_t

Source§

fn from(value: AeronArchivePersistentSubscription) -> Self

Converts to this type from the input type.
Source§

impl From<aeron_archive_persistent_subscription_stct> for AeronArchivePersistentSubscription

Source§

fn from(value: aeron_archive_persistent_subscription_t) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.