pub struct AeronPublication { /* private fields */ }
Implementations§
Source§impl AeronPublication
impl AeronPublication
Sourcepub fn new_zeroed() -> Result<Self, AeronCError>
pub fn new_zeroed() -> Result<Self, AeronCError>
creates zeroed struct where the underlying c struct is on the heap
Sourcepub fn offer<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback>(
&self,
buffer: &[u8],
reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl>>,
) -> i64
pub fn offer<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback>( &self, buffer: &[u8], reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl>>, ) -> i64
Sourcepub fn offer_once<AeronReservedValueSupplierHandlerImpl: FnMut(*mut u8, usize) -> i64>(
&self,
buffer: &[u8],
reserved_value_supplier: AeronReservedValueSupplierHandlerImpl,
) -> i64
pub fn offer_once<AeronReservedValueSupplierHandlerImpl: FnMut(*mut u8, usize) -> i64>( &self, buffer: &[u8], reserved_value_supplier: AeronReservedValueSupplierHandlerImpl, ) -> i64
Non-blocking publish of a buffer containing a message.
§Parameters
-
buffer
to publish. -
length
of the buffer. -
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.
NOTE: aeron must not store this closure and instead use it immediately. If not you will get undefined behaviour, use with care
Sourcepub fn offerv<AeronReservedValueSupplierHandlerImpl: AeronReservedValueSupplierCallback>(
&self,
iov: &AeronIovec,
iovcnt: usize,
reserved_value_supplier: Option<&Handler<AeronReservedValueSupplierHandlerImpl>>,
) -> i64
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.
Sourcepub fn offerv_once<AeronReservedValueSupplierHandlerImpl: FnMut(*mut u8, usize) -> i64>(
&self,
iov: &AeronIovec,
iovcnt: usize,
reserved_value_supplier: AeronReservedValueSupplierHandlerImpl,
) -> i64
pub fn offerv_once<AeronReservedValueSupplierHandlerImpl: FnMut(*mut u8, usize) -> 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.
NOTE: aeron must not store this closure and instead use it immediately. If not you will get undefined behaviour, use with care
Sourcepub fn try_claim(&self, length: usize, buffer_claim: &AeronBufferClaim) -> i64
pub fn try_claim(&self, length: usize, buffer_claim: &AeronBufferClaim) -> i64
Try to claim a range in the publication log into which a message can be written with zero copy semantics. Once the message has been written then aeron_buffer_claim_commit should be called thus making it available. A claim length cannot be greater than max payload length.
Note: This method can only be used for message lengths less than MTU length minus header. If the claim is held for more than the aeron.publication.unblock.timeout system property then the driver will assume the publication thread is dead and will unblock the claim thus allowing other threads to make progress and other claims to be sent to reach end-of-stream (EOS).
@code
AeronBufferClaim
buffer_claim;
if (AeronPublication
ry_claim(publication, length, &buffer_claim) > 0L)
{
// work with buffer_claim->data directly.
aeron_buffer_claim_commit(&buffer_claim);
}
@endcode
§Parameters
-
length
of the message. -
buffer_claim
to be populated if the claim succeeds.
§Return
the new stream position otherwise a negative error value.
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 fn is_connected(&self) -> bool
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.
Sourcepub fn constants(
&self,
constants: &AeronPublicationConstants,
) -> Result<i32, AeronCError>
pub fn constants( &self, constants: &AeronPublicationConstants, ) -> Result<i32, AeronCError>
Sourcepub fn get_constants(&self) -> Result<AeronPublicationConstants, AeronCError>
pub fn get_constants(&self) -> Result<AeronPublicationConstants, AeronCError>
Fill in a structure with the constants in use by a publication.
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 close<AeronNotificationHandlerImpl: AeronNotificationCallback>(
&self,
on_close_complete: Option<&Handler<AeronNotificationHandlerImpl>>,
) -> Result<i32, AeronCError>
pub fn close<AeronNotificationHandlerImpl: AeronNotificationCallback>( &self, on_close_complete: Option<&Handler<AeronNotificationHandlerImpl>>, ) -> Result<i32, AeronCError>
Asynchronously close the publication. Will callback on the on_complete notification when the subscription is closed. The callback is optional, use NULL for the on_complete callback if not required.
§Parameters
-
on_close_complete
optional callback to execute once the subscription has been closed and freed. This may happen on a separate thread, so the caller should ensure that clientd has the appropriate lifetime. -
on_close_complete_clientd
parameter to pass to the on_complete callback.
§Return
0 for success or -1 for error.
Sourcepub fn close_once<AeronNotificationHandlerImpl: FnMut()>(
&self,
on_close_complete: AeronNotificationHandlerImpl,
) -> Result<i32, AeronCError>
pub fn close_once<AeronNotificationHandlerImpl: FnMut()>( &self, on_close_complete: AeronNotificationHandlerImpl, ) -> Result<i32, AeronCError>
Asynchronously close the publication. Will callback on the on_complete notification when the subscription is closed. The callback is optional, use NULL for the on_complete callback if not required.
§Parameters
-
on_close_complete
optional callback to execute once the subscription has been closed and freed. This may happen on a separate thread, so the caller should ensure that clientd has the appropriate lifetime. -
on_close_complete_clientd
parameter to pass to the on_complete callback.
§Return
0 for success or -1 for error.
NOTE: aeron must not store this closure and instead use it immediately. If not you will get undefined behaviour, use with care
Sourcepub fn session_id(&self) -> i32
pub fn session_id(&self) -> i32
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 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
pub fn image_location( dst: *mut c_char, length: usize, aeron_dir: &str, correlation_id: i64, ) -> Result<i32, AeronCError>
pub fn get_inner(&self) -> *mut aeron_publication_t
Source§impl AeronPublication
impl AeronPublication
pub fn new(async_: &AeronAsyncAddPublication) -> Result<Self, AeronCError>
Source§impl AeronPublication
impl AeronPublication
pub fn async_add_destination( &mut self, client: &Aeron, destination: &str, ) -> Result<AeronAsyncDestination, AeronCError>
pub fn add_destination( &mut self, client: &Aeron, destination: &str, timeout: Duration, ) -> Result<(), AeronCError>
Trait Implementations§
Source§impl Clone for AeronPublication
impl Clone for AeronPublication
Source§fn clone(&self) -> AeronPublication
fn clone(&self) -> AeronPublication
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more