Skip to main content

AeronPublication

Struct AeronPublication 

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

Implementations§

Source§

impl AeronPublication

Source§

impl AeronPublication

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 offerv<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback>( &self, iov: &AeronIovec, iovcnt: usize, reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl>>, ) -> i64

Non-blocking publish by gathering buffer vectors into a message.

§Parameters
  • iov array for the vectors

  • iovcnt of the number of vectors

  • reserved_value_supplier to use for setting the reserved value field or NULL.

  • clientd to pass to the reserved_value_supplier.

§Return

the new stream position otherwise a negative error value.

Source

pub fn offerv_fn<AeronReservedValueSupplierHandlerImpl: FnMut(&mut [u8]) -> i64>( &self, iov: &AeronIovec, iovcnt: usize, reserved_value_supplier: AeronReservedValueSupplierHandlerImpl, ) -> i64

Non-blocking publish by gathering buffer vectors into a message.

§Parameters
  • iov array for the vectors

  • iovcnt of the number of vectors

  • reserved_value_supplier to use for setting the reserved value field or NULL.

  • clientd to pass to the reserved_value_supplier.

§Return

the new stream position otherwise a negative error value.

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 channel_status(&self) -> i64

Get the status of the media channel for this publication.

The status will be ERRORED (-1) if a socket exception occurs on setup and ACTIVE (1) if all is well.

§Return

1 for ACTIVE, -1 for ERRORED

Source

pub fn is_closed(&self) -> bool

Has the publication closed?

§Return

true if this publication is closed.

Source

pub fn is_connected(&self) -> bool

Has the publication seen an active Subscriber recently?

§Return

true if this publication has recently seen an active subscriber otherwise false.

Source

pub fn constants( &self, constants: &AeronPublicationConstants, ) -> Result<i32, AeronCError>

Fill in a structure with the constants in use by a publication.

§Parameters
  • publication to get the constants for.

  • constants structure to fill in with the constants

§Return

0 for success and -1 for error.

Source

pub fn get_constants(&self) -> Result<AeronPublicationConstants, AeronCError>

Fill in a structure with the constants in use by a publication.

Source

pub fn position(&self) -> i64

Get the current position to which the publication has advanced for this stream.

§Return

the current position to which the publication has advanced for this stream or a negative error value.

Source

pub fn position_limit(&self) -> i64

Get the position limit beyond which this publication will be back pressured.

This should only be used as a guide to determine when back pressure is likely to be applied.

§Return

the position limit beyond which this publication will be back pressured or a negative error value.

Source

pub fn channel(&self) -> &str

Get the publication’s channel

§Return

channel uri string

Source

pub fn stream_id(&self) -> i32

Get the publication’s stream id

§Return

stream id

Source

pub fn session_id(&self) -> i32

Get the publication’s session id

§Return

session id

Source

pub fn local_sockaddrs( &self, address_vec: &AeronIovec, address_vec_len: usize, ) -> Result<i32, AeronCError>

Get all of the local socket addresses for this publication. Typically only one representing the control address.

§Parameters
  • address_vec to hold the received addresses

  • address_vec_len available length of the vector to hold the addresses

§Return

number of addresses found or -1 if there is an error. @see aeron_subscription_local_sockaddrs

Source

pub fn image_location( dst: &mut [u8], aeron_dir: &CStr, correlation_id: i64, ) -> Result<i32, AeronCError>

Source

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

Source

pub unsafe fn get_inner_mut(&self) -> &mut aeron_publication_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_publication_t

Source§

impl AeronPublication

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 AeronPublication

Source

pub fn close_with_handler<AeronNotificationHandlerImpl: AeronNotificationCallback>( self, on_close_complete: Option<&Handler<AeronNotificationHandlerImpl>>, ) -> Result<(), AeronCError>

Like Self::close, but notifies on_close_complete when the close finishes. The handler must outlive the notification (keep your Handler alive until it has fired).

Source§

impl AeronPublication

Source

pub fn is_ready(&self) -> bool

Source§

impl AeronPublication

Source

pub fn async_add_destination( &self, client: &Aeron, destination: &CStr, ) -> Result<AeronAsyncDestination, AeronCError>

Source

pub fn add_destination( &self, destination: &CStr, timeout: Duration, ) -> Result<(), AeronCError>

Add destination (see AeronSubscription::add_destination); the owning Aeron client is retrieved from the publication’s dependency graph.

Source§

impl AeronPublication

Source

pub fn offer_raw<H: AeronReservedValueSupplierCallback>( &self, buffer: &[u8], reserved_value_supplier: Option<&Handler<H>>, ) -> i64

Raw, branch-free variant of Self::offer: returns the new stream position, or a negative Aeron sentinel (see AeronOfferError::from_position).

Distinct name from the generated offer method (different signatures) to avoid macro-hygiene name conflicts.

Source

pub fn try_claim_raw( &self, length: usize, buffer_claim: &AeronBufferClaim, ) -> i64

Raw, branch-free variant of Self::try_claim: position or negative sentinel.

Source

pub fn offer_with_reserved_value<H: AeronReservedValueSupplierCallback>( &self, buffer: &[u8], reserved_value_supplier: Option<&Handler<H>>, ) -> Result<i64, AeronOfferError>

Self::offer with a reserved-value supplier.

Source

pub fn try_claim_owned( &self, length: usize, ) -> Result<AeronClaim, AeronOfferError>

Zero-copy claim returning a RAII AeronClaim that is auto-aborted on drop unless explicitly committed or aborted.

Source

pub fn offer_parts(&self, parts: &[&[u8]]) -> Result<i64, AeronOfferError>

Gathering (vectored) publish: offer up to MAX_OFFER_PARTS buffers as ONE message without concatenating them — zero allocation, zero copy on the caller side (the driver gathers the parts directly).

This is the header+payload send: instead of building a Vec per message (vec.extend(header); vec.extend(payload); offer(&vec)), pass the parts:

publication.offer_parts(&[&header_bytes, payload])?;

The aeron_iovec_t array is built on the stack. Same typed-error semantics as Self::offer. Returns AeronOfferError::TooManyParts if more than MAX_OFFER_PARTS parts are passed (use Self::offerv with your own iovec array for larger gathers).

Source

pub fn status(&self) -> AeronStatus

High-level connection state derived from the publication handle.

Source

pub fn registration_id(&self) -> Result<i64, AeronCError>

Convenience accessor for the registration id (no direct C accessor exists; backed by Self::get_constants). session_id, stream_id and channel have cheap direct getters — prefer those; for registration_id / max_payload_length in a hot loop, call Self::get_constants once and reuse the returned AeronPublicationConstants.

Source

pub fn max_payload_length(&self) -> Result<usize, AeronCError>

Convenience accessor for the max payload length (see Self::registration_id).

Source§

impl AeronPublication

Source

pub fn offer(&self, buffer: &[u8]) -> Result<i64, AeronOfferError>

Non-blocking publish of buffer, returning the new stream position.

Typed-error convenience wrapper over Self::offer_raw; see AeronOfferError::is_retryable for retry-loop guidance.

Source

pub fn try_claim( &self, length: usize, buffer_claim: &AeronBufferClaim, ) -> Result<i64, AeronOfferError>

Zero-copy claim with typed errors — see Self::try_claim_owned for RAII.

Source§

impl AeronPublication

Source

pub fn get_archive_position(&self) -> Result<i64, AeronCError>

Retrieves the current active live archive position using the Aeron counters. Returns an error if not found.

Source

pub fn get_archive_position_with( &self, counters: &AeronCountersReader, ) -> Result<i64, AeronCError>

Retrieves the current active live archive position using the provided counter reader. Returns an error if not found.

Source

pub fn is_archive_position_with(&self, length_inclusive: usize) -> bool

Checks if the publication’s current position is within a specified inclusive length of the archive position.

Trait Implementations§

Source§

impl Clone for AeronPublication

Source§

fn clone(&self) -> AeronPublication

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 Debug for AeronPublication

Source§

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

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

impl Deref for AeronPublication

Source§

type Target = aeron_publication_stct

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl From<&AeronPublication> for *mut aeron_publication_t

Source§

fn from(value: &AeronPublication) -> Self

Converts to this type from the input type.
Source§

impl From<*const aeron_publication_stct> for AeronPublication

Source§

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

Converts to this type from the input type.
Source§

impl From<*mut aeron_publication_stct> for AeronPublication

Source§

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

Converts to this type from the input type.
Source§

impl From<AeronPublication> for *mut aeron_publication_t

Source§

fn from(value: AeronPublication) -> Self

Converts to this type from the input type.
Source§

impl From<AeronPublication> for aeron_publication_t

Source§

fn from(value: AeronPublication) -> Self

Converts to this type from the input type.
Source§

impl From<aeron_publication_stct> for AeronPublication

Source§

fn from(value: aeron_publication_t) -> Self

Converts to this type from the input type.
Source§

impl Send for AeronPublication

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.