pub struct AeronExclusivePublication<S: ResourceStorage<aeron_exclusive_publication_t> = LiveCResource<aeron_exclusive_publication_t>> { /* private fields */ }Implementations§
Source§impl<S: ResourceStorage<aeron_exclusive_publication_t>> AeronExclusivePublication<S>
impl<S: ResourceStorage<aeron_exclusive_publication_t>> AeronExclusivePublication<S>
Sourcepub fn offerv<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback, AeronReservedValueSupplierHandlerImplPolicy: CallbackPolicy>(
&self,
iov: &AeronIovec,
iovcnt: usize,
reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl, AeronReservedValueSupplierHandlerImplPolicy>>,
) -> i64
pub fn offerv<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback, AeronReservedValueSupplierHandlerImplPolicy: CallbackPolicy>( &self, iov: &AeronIovec, iovcnt: usize, reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl, AeronReservedValueSupplierHandlerImplPolicy>>, ) -> i64
Sourcepub fn offerv_fn<AeronReservedValueSupplierHandlerImpl: FnMut(&mut [u8]) -> i64>(
&self,
iov: &AeronIovec,
iovcnt: usize,
reserved_value_supplier: AeronReservedValueSupplierHandlerImpl,
) -> i64
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
iovarray for the vectorsiovcntof the number of vectorsreserved_value_supplierto use for setting the reserved value field or NULL.
§Return
the new stream position otherwise a negative error value.
Stack-borrowed closure variant. The FnMut closure lives on the caller’s
stack and is borrowed for this call only. The callback fires synchronously,
so nothing is heap-allocated or stored and the closure may borrow local
state. Generated only for callbacks C does not retain. Prefer it to the
Handler form on the hot path
§Panics
A panic in the closure is caught so the C call can finish, then passed to the caller once it returns
Sourcepub fn append_padding(&self, length: usize) -> i64
pub fn append_padding(&self, length: usize) -> i64
Sourcepub fn offer_block(&self, buffer: &[u8]) -> i64
pub fn offer_block(&self, buffer: &[u8]) -> i64
Sourcepub fn channel_status(&self) -> i64
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
Sourcepub unsafe fn constants(
&self,
constants: &AeronPublicationConstants<impl ResourceStorage<aeron_publication_constants_t>>,
) -> Result<i32, AeronCError>
pub unsafe fn constants( &self, constants: &AeronPublicationConstants<impl ResourceStorage<aeron_publication_constants_t>>, ) -> Result<i32, AeronCError>
Fill in a structure with the constants in use by a publication.
§Parameters
constantsstructure to fill in with the constants
§Return
0 for success and -1 for error.
§Safety
The output may contain borrowed native pointers. Do not use those pointers after the queried handle is dropped or changed. Prefer the lifetime-bound get_constants, get_buffers or get_values method.
Sourcepub fn get_constants(
&self,
) -> Result<AeronPublicationConstants<ScopedInline<'_, aeron_publication_constants_t>>, AeronCError>
pub fn get_constants( &self, ) -> Result<AeronPublicationConstants<ScopedInline<'_, aeron_publication_constants_t>>, AeronCError>
Fill in a structure with the constants in use by a publication.
Sourcepub fn original_registration_id(&self) -> Result<i64, AeronCError>
pub fn original_registration_id(&self) -> Result<i64, AeronCError>
get_constants()?.original_registration_id(). Call get_constants() once to read several fields
Sourcepub fn registration_id(&self) -> Result<i64, AeronCError>
pub fn registration_id(&self) -> Result<i64, AeronCError>
get_constants()?.registration_id(). Call get_constants() once to read several fields
Sourcepub fn max_possible_position(&self) -> Result<i64, AeronCError>
pub fn max_possible_position(&self) -> Result<i64, AeronCError>
get_constants()?.max_possible_position(). Call get_constants() once to read several fields
Sourcepub fn position_bits_to_shift(&self) -> Result<usize, AeronCError>
pub fn position_bits_to_shift(&self) -> Result<usize, AeronCError>
get_constants()?.position_bits_to_shift(). Call get_constants() once to read several fields
Sourcepub fn term_buffer_length(&self) -> Result<usize, AeronCError>
pub fn term_buffer_length(&self) -> Result<usize, AeronCError>
get_constants()?.term_buffer_length(). Call get_constants() once to read several fields
Sourcepub fn max_message_length(&self) -> Result<usize, AeronCError>
pub fn max_message_length(&self) -> Result<usize, AeronCError>
get_constants()?.max_message_length(). Call get_constants() once to read several fields
Sourcepub fn max_payload_length(&self) -> Result<usize, AeronCError>
pub fn max_payload_length(&self) -> Result<usize, AeronCError>
get_constants()?.max_payload_length(). Call get_constants() once to read several fields
Sourcepub fn stream_id(&self) -> Result<i32, AeronCError>
pub fn stream_id(&self) -> Result<i32, AeronCError>
get_constants()?.stream_id(). Call get_constants() once to read several fields
Sourcepub fn session_id(&self) -> Result<i32, AeronCError>
pub fn session_id(&self) -> Result<i32, AeronCError>
get_constants()?.session_id(). Call get_constants() once to read several fields
Sourcepub fn initial_term_id(&self) -> Result<i32, AeronCError>
pub fn initial_term_id(&self) -> Result<i32, AeronCError>
get_constants()?.initial_term_id(). Call get_constants() once to read several fields
Sourcepub fn publication_limit_counter_id(&self) -> Result<i32, AeronCError>
pub fn publication_limit_counter_id(&self) -> Result<i32, AeronCError>
get_constants()?.publication_limit_counter_id(). Call get_constants() once to read several fields
Sourcepub fn channel_status_indicator_id(&self) -> Result<i32, AeronCError>
pub fn channel_status_indicator_id(&self) -> Result<i32, AeronCError>
get_constants()?.channel_status_indicator_id(). Call get_constants() once to read several fields
Sourcepub fn position(&self) -> i64
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.
Sourcepub fn position_limit(&self) -> i64
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.
Sourcepub fn revoke_on_close(&self)
pub fn revoke_on_close(&self)
Revoke this publication when it’s closed.
Sourcepub unsafe fn revoke<AeronNotificationHandlerImpl: AeronNotificationCallback + Send + 'static>(
&self,
on_close_complete: Option<AeronNotificationHandlerImpl>,
) -> Result<Option<SharedHandler<AeronNotificationHandlerImpl>>, AeronCError>
pub unsafe fn revoke<AeronNotificationHandlerImpl: AeronNotificationCallback + Send + 'static>( &self, on_close_complete: Option<AeronNotificationHandlerImpl>, ) -> Result<Option<SharedHandler<AeronNotificationHandlerImpl>>, AeronCError>
Asynchronously revoke and close the publication. Will callback on the on_complete notification when the publicaiton is closed. The callback is optional, use NULL for the on_complete callback if not required.
§Parameters
on_close_completeoptional callback to execute once the publication has been revoked, closed and freed. This may happen on a separate thread, so the caller should ensure that clientd has the appropriate lifetime.
§Return
0 for success or -1 for error.
§Safety
This bypasses Rust ownership. Keep all retained pointers valid until native cleanup. Initializers require exclusive access and must not overwrite live native state or invalidate borrowed views. After raw removal or deletion, prevent all further access and Rust cleanup through every alias. Prefer the owning handle’s constructor, close or cancel method.
An owned wrapper keeps the callback alive until C cleanup finishes.
A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive.
Dropping the handler does not unregister the callback.
Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Has the exclusive publication seen an active Subscriber recently?
§Return
true if this publication has recently seen an active subscriber otherwise false.
Sourcepub fn local_sockaddrs(
&self,
address_vec: &AeronIovec,
address_vec_len: usize,
) -> Result<i32, AeronCError>
pub fn local_sockaddrs( &self, address_vec: &AeronIovec, address_vec_len: usize, ) -> Result<i32, AeronCError>
Get all of the local socket addresses for this exclusive publication. Typically only one representing the control address.
@see aeron_subscription_local_sockaddrs
§Parameters
address_vecto hold the received addressesaddress_vec_lenavailable length of the vector to hold the addresses
§Return
number of addresses found or -1 if there is an error.
pub fn get_inner(&self) -> *mut aeron_exclusive_publication_t
Sourcepub unsafe fn get_inner_mut(&self) -> &mut aeron_exclusive_publication_t
pub unsafe fn get_inner_mut(&self) -> &mut aeron_exclusive_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.
Sourcepub unsafe fn get_inner_ref(&self) -> &aeron_exclusive_publication_t
pub unsafe fn get_inner_ref(&self) -> &aeron_exclusive_publication_t
Borrow the native struct.
§Safety
No Rust or native call may mutate the struct while this reference is alive. Shared wrappers also require coordination with other threads.
Source§impl AeronExclusivePublication
impl AeronExclusivePublication
Sourcepub unsafe fn from_ptr(
ptr: *mut aeron_exclusive_publication_t,
) -> AeronExclusivePublication<Borrowed<aeron_exclusive_publication_t>>
pub unsafe fn from_ptr( ptr: *mut aeron_exclusive_publication_t, ) -> AeronExclusivePublication<Borrowed<aeron_exclusive_publication_t>>
Borrow a native pointer without taking ownership.
§Safety
The pointer must be non-null. It and its parents must remain live for every use. Calls must follow Aeron’s threading and aliasing rules.
Source§impl AeronExclusivePublication
impl AeronExclusivePublication
Sourcepub fn close(self) -> Result<(), AeronCError>
pub fn close(self) -> Result<(), AeronCError>
Releases this handle. Native cleanup waits for the last owning clone when the resource can be retained by another handle.
Source§impl AeronExclusivePublication
impl AeronExclusivePublication
Sourcepub fn close_with_handler<AeronNotificationHandlerImpl: AeronNotificationCallback + Send + 'static>(
self,
on_close_complete: Option<&SharedHandler<AeronNotificationHandlerImpl>>,
) -> Result<(), AeronCError>
pub fn close_with_handler<AeronNotificationHandlerImpl: AeronNotificationCallback + Send + 'static>( self, on_close_complete: Option<&SharedHandler<AeronNotificationHandlerImpl>>, ) -> Result<(), AeronCError>
Like Self::close, but calls on_close_complete from the conductor once
the close finishes. Returns an error unless this is the last owning handle.
The client keeps the SharedHandler alive until it has fired
Source§impl AeronExclusivePublication
impl AeronExclusivePublication
Sourcepub fn async_add_destination(
&self,
client: &Aeron,
uri: &CStr,
) -> Result<AeronAsyncDestination, AeronCError>
pub fn async_add_destination( &self, client: &Aeron, uri: &CStr, ) -> Result<AeronAsyncDestination, AeronCError>
Start a destination change. Dropping the operation does not cancel it.
Sourcepub fn add_destination(
&self,
uri: &CStr,
timeout: Duration,
) -> Result<(), AeronCError>
pub fn add_destination( &self, uri: &CStr, timeout: Duration, ) -> Result<(), AeronCError>
Wait for a destination change or the timeout. Drives an invoker conductor when needed. The handle retains its owning client. A timeout does not cancel the native operation.
Sourcepub fn async_remove_destination(
&self,
client: &Aeron,
uri: &CStr,
) -> Result<AeronAsyncDestination, AeronCError>
pub fn async_remove_destination( &self, client: &Aeron, uri: &CStr, ) -> Result<AeronAsyncDestination, AeronCError>
Start a destination change. Dropping the operation does not cancel it.
Sourcepub fn remove_destination(
&self,
uri: &CStr,
timeout: Duration,
) -> Result<(), AeronCError>
pub fn remove_destination( &self, uri: &CStr, timeout: Duration, ) -> Result<(), AeronCError>
Wait for a destination change or the timeout. Drives an invoker conductor when needed. The handle retains its owning client. A timeout does not cancel the native operation.
Sourcepub fn async_remove_destination_by_id(
&self,
client: &Aeron,
destination_registration_id: i64,
) -> Result<AeronAsyncDestination, AeronCError>
pub fn async_remove_destination_by_id( &self, client: &Aeron, destination_registration_id: i64, ) -> Result<AeronAsyncDestination, AeronCError>
Start a destination change. Dropping the operation does not cancel it.
Sourcepub fn remove_destination_by_id(
&self,
destination_registration_id: i64,
timeout: Duration,
) -> Result<(), AeronCError>
pub fn remove_destination_by_id( &self, destination_registration_id: i64, timeout: Duration, ) -> Result<(), AeronCError>
Wait for a destination change or the timeout. Drives an invoker conductor when needed. The handle retains its owning client. A timeout does not cancel the native operation.
Source§impl<S: ResourceStorage<aeron_exclusive_publication_t>> AeronExclusivePublication<S>
impl<S: ResourceStorage<aeron_exclusive_publication_t>> AeronExclusivePublication<S>
Sourcepub fn offer_raw<H: AeronReservedValueSupplierCallback>(
&self,
buffer: &[u8],
reserved_value_supplier: Option<&Handler<H, impl CallbackPolicy>>,
) -> i64
pub fn offer_raw<H: AeronReservedValueSupplierCallback>( &self, buffer: &[u8], reserved_value_supplier: Option<&Handler<H, impl CallbackPolicy>>, ) -> 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.
Sourcepub fn try_claim_raw(
&self,
length: usize,
buffer_claim: &AeronBufferClaim<impl ResourceStorage<aeron_buffer_claim_t>>,
) -> i64
pub fn try_claim_raw( &self, length: usize, buffer_claim: &AeronBufferClaim<impl ResourceStorage<aeron_buffer_claim_t>>, ) -> i64
Raw, branch-free variant of Self::try_claim: position or negative sentinel.
Sourcepub fn offer_with_reserved_value<H: AeronReservedValueSupplierCallback>(
&self,
buffer: &[u8],
reserved_value_supplier: Option<&Handler<H, impl CallbackPolicy>>,
) -> Result<i64, AeronOfferError>
pub fn offer_with_reserved_value<H: AeronReservedValueSupplierCallback>( &self, buffer: &[u8], reserved_value_supplier: Option<&Handler<H, impl CallbackPolicy>>, ) -> Result<i64, AeronOfferError>
Self::offer with a reserved-value supplier.
Sourcepub fn try_claim_owned(
&self,
length: usize,
) -> Result<AeronClaim<'_>, AeronOfferError>
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.
Sourcepub fn offer_parts(&self, parts: &[&[u8]]) -> Result<i64, AeronOfferError>
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 first: no allocation, and the parts are
copied straight into the term buffer, as offer copies its one buffer.
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).
Sourcepub fn status(&self) -> AeronStatus
pub fn status(&self) -> AeronStatus
High-level connection state derived from the publication handle.
Source§impl AeronExclusivePublication
impl AeronExclusivePublication
Sourcepub fn revoke_with_handler<AeronNotificationHandlerImpl: AeronNotificationCallback + Send + 'static>(
self,
on_close_complete: Option<&SharedHandler<AeronNotificationHandlerImpl>>,
) -> Result<(), AeronCError>
pub fn revoke_with_handler<AeronNotificationHandlerImpl: AeronNotificationCallback + Send + 'static>( self, on_close_complete: Option<&SharedHandler<AeronNotificationHandlerImpl>>, ) -> Result<(), AeronCError>
Safe version of Self::revoke: revokes and closes the publication, then notifies
on_close_complete like Self::close_with_handler. Errors without revoking when
another owning clone is alive. Runs once at shutdown, so the SharedHandler mutex is
off the hot path
Source§impl<S: ResourceStorage<aeron_exclusive_publication_t>> AeronExclusivePublication<S>
impl<S: ResourceStorage<aeron_exclusive_publication_t>> AeronExclusivePublication<S>
Sourcepub fn offer(&self, buffer: &[u8]) -> Result<i64, AeronOfferError>
pub fn offer(&self, buffer: &[u8]) -> Result<i64, AeronOfferError>
Without a supplier there is no callback to re-enter, so this keeps &self
pub fn try_claim( &self, length: usize, buffer_claim: &AeronBufferClaim<impl ResourceStorage<aeron_buffer_claim_t>>, ) -> Result<i64, AeronOfferError>
Trait Implementations§
Source§impl<S: Clone + ResourceStorage<aeron_exclusive_publication_t>> Clone for AeronExclusivePublication<S>
impl<S: Clone + ResourceStorage<aeron_exclusive_publication_t>> Clone for AeronExclusivePublication<S>
Source§fn clone(&self) -> AeronExclusivePublication<S>
fn clone(&self) -> AeronExclusivePublication<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more