Struct rusteron_media_driver::AeronSubscription
source · pub struct AeronSubscription { /* private fields */ }
Implementations§
source§impl AeronSubscription
impl AeronSubscription
pub fn new_zeroed() -> Result<Self, AeronCError>
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 the images under the subscription for available message fragments.
Each fragment read will be a whole message if it is under MTU length. If larger than MTU then it will come as a series of fragments ordered within a session.
To assemble messages that span multiple fragments then use AeronFragmentAssembler
.
§Parameters
-
handler
for handling each message fragment as it is read. -
fragment_limit
number of message fragments to limit when polling across multiple images.
§Return
the number of fragments received or -1 for error.
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 the images under the subscription for available message fragments. Control is applied to fragments in the stream. If more fragments can be read on another stream they will even if BREAK or ABORT is returned from the fragment handler.
Each fragment read will be a whole message if it is under MTU length. If larger than MTU then it will come as a series of fragments ordered within a session.
To assemble messages that span multiple fragments then use AeronControlledFragmentAssembler
.
§Parameters
-
handler
for handling each message fragment as it is read. -
fragment_limit
number of message fragments to limit when polling across multiple images.
§Return
the number of fragments received or -1 for error.
sourcepub fn block_poll<AeronBlockHandlerHandlerImpl: AeronBlockHandlerCallback>(
&self,
handler: Option<&Handler<AeronBlockHandlerHandlerImpl>>,
block_length_limit: usize,
) -> c_long
pub fn block_poll<AeronBlockHandlerHandlerImpl: AeronBlockHandlerCallback>( &self, handler: Option<&Handler<AeronBlockHandlerHandlerImpl>>, block_length_limit: usize, ) -> c_long
Poll the images under the subscription for available message fragments in blocks.
This method is useful for operations like bulk archiving and messaging indexing.
§Parameters
-
handler
to receive a block of fragments from each image. -
block_length_limit
for each image polled.
§Return
the number of bytes consumed or -1 for error.
sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Is this subscription connected by having at least one open publication image.
§Return
true if this subscription connected by having at least one open publication image.
sourcepub fn constants(
&self,
constants: &AeronSubscriptionConstants,
) -> Result<i32, AeronCError>
pub fn constants( &self, constants: &AeronSubscriptionConstants, ) -> Result<i32, AeronCError>
sourcepub fn image_count(&self) -> Result<i32, AeronCError>
pub fn image_count(&self) -> Result<i32, AeronCError>
Count of images associated to this subscription.
§Return
count of count associated to this subscription or -1 for error.
sourcepub fn image_by_session_id(&self, session_id: i32) -> AeronImage
pub fn image_by_session_id(&self, session_id: i32) -> AeronImage
Return the image associated with the given session_id under the given subscription.
Note: the returned image is considered retained by the application and thus must be released via aeron_image_release when finished or if the image becomes unavailable.
§Parameters
session_id
associated with the image.
§Return
image associated with the given session_id or NULL if no image exists.
sourcepub fn image_at_index(&self, index: usize) -> AeronImage
pub fn image_at_index(&self, index: usize) -> AeronImage
sourcepub fn for_each_image(
&self,
handler: Option<unsafe extern "C" fn(image: *mut aeron_image_t, clientd: *mut c_void)>,
clientd: *mut c_void,
)
pub fn for_each_image( &self, handler: Option<unsafe extern "C" fn(image: *mut aeron_image_t, clientd: *mut c_void)>, clientd: *mut c_void, )
Iterate over the images for this subscription calling the given function.
§Parameters
-
handler
to be called for each image. -
clientd
to be passed to the handler.
sourcepub fn image_retain(&self, image: &AeronImage) -> Result<i32, AeronCError>
pub fn image_retain(&self, image: &AeronImage) -> Result<i32, AeronCError>
Retain the given image for access in the application.
Note: A retain call must have a corresponding release call. Note: Subscriptions are not threadsafe and should not be shared between subscribers.
§Parameters
-
subscription
that image is part of. -
image
to retain
§Return
0 for success and -1 for error.
sourcepub fn image_release(&self, image: &AeronImage) -> Result<i32, AeronCError>
pub fn image_release(&self, image: &AeronImage) -> Result<i32, AeronCError>
sourcepub fn channel_status(&self) -> i64
pub fn channel_status(&self) -> i64
Get the status of the media channel for this subscription.
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 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 subscription. 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 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 subscription. Multiple addresses can occur if this is a multi-destination subscription. Addresses will a string representation in numeric form. IPv6 addresses will be surrounded by ‘[’ and ‘]’ so that the ‘:’ that separate the parts are distinguishable from the port delimiter. E.g. [fe80::7552:c06e:6bf4:4160]:12345. As of writing the maximum length for a formatted address is 54 bytes including the NULL terminator. AERON_CLIENT_MAX_LOCAL_ADDRESS_STR_LEN is defined to provide enough space to fit the returned string. Returned strings will be NULL terminated. If the buffer to hold the address can not hold enough of the message it will be truncated and the last character will be null.
If the address_vec_len is less the total number of addresses available then the first addresses found up to that length will be placed into the address_vec. However the function will return the total number of addresses available so if if that is larger than the input array then the client code may wish to re-query with a larger array to get them all.
§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.
sourcepub fn resolved_endpoint(
&self,
address: &str,
address_len: usize,
) -> Result<i32, AeronCError>
pub fn resolved_endpoint( &self, address: &str, address_len: usize, ) -> Result<i32, AeronCError>
Retrieves the first local socket address for this subscription. If this is not MDS then it will be the one representing endpoint for this subscription.
@see aeron_subscription_local_Sockaddr
s
§Parameters
-
address
for the received address -
address_len
available length for the copied address.
§Return
-1 on error, 0 if address not found, 1 if address is found.
sourcepub fn try_resolve_channel_endpoint_port(
&self,
uri: *mut c_char,
uri_len: usize,
) -> Result<i32, AeronCError>
pub fn try_resolve_channel_endpoint_port( &self, uri: *mut c_char, uri_len: usize, ) -> Result<i32, AeronCError>
Retrieves the channel URI for this subscription with any wildcard ports filled in. If the channel is not UDP or
does not have a wildcard port (0
), then it will return the original URI.
§Parameters
-
uri
buffer to hold the resolved uri -
uri_len
length of the buffer
§Return
-1 on failure or the number of bytes written to the buffer (excluding the NULL terminator). Writing is done on a per key basis, so if the buffer was truncated before writing completed, it will only include the byte count up to the key that overflowed. However, the invariant that if the number returned >= uri_len, then output will have been truncated.
pub fn get_inner(&self) -> *mut aeron_subscription_t
source§impl AeronSubscription
impl AeronSubscription
pub fn new(async_: &AeronAsyncAddSubscription) -> Result<Self, AeronCError>
Trait Implementations§
source§impl Clone for AeronSubscription
impl Clone for AeronSubscription
source§fn clone(&self) -> AeronSubscription
fn clone(&self) -> AeronSubscription
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AeronSubscription
impl Debug for AeronSubscription
source§impl Deref for AeronSubscription
impl Deref for AeronSubscription
source§impl From<&AeronSubscription> for *mut aeron_subscription_t
impl From<&AeronSubscription> for *mut aeron_subscription_t
source§fn from(value: &AeronSubscription) -> Self
fn from(value: &AeronSubscription) -> Self
source§impl From<*const aeron_subscription_stct> for AeronSubscription
impl From<*const aeron_subscription_stct> for AeronSubscription
source§fn from(value: *const aeron_subscription_t) -> Self
fn from(value: *const aeron_subscription_t) -> Self
source§impl From<*mut aeron_subscription_stct> for AeronSubscription
impl From<*mut aeron_subscription_stct> for AeronSubscription
source§fn from(value: *mut aeron_subscription_t) -> Self
fn from(value: *mut aeron_subscription_t) -> Self
source§impl From<AeronSubscription> for *mut aeron_subscription_t
impl From<AeronSubscription> for *mut aeron_subscription_t
source§fn from(value: AeronSubscription) -> Self
fn from(value: AeronSubscription) -> Self
source§impl From<AeronSubscription> for aeron_subscription_t
impl From<AeronSubscription> for aeron_subscription_t
source§fn from(value: AeronSubscription) -> Self
fn from(value: AeronSubscription) -> Self
source§impl From<aeron_subscription_stct> for AeronSubscription
impl From<aeron_subscription_stct> for AeronSubscription
source§fn from(value: aeron_subscription_t) -> Self
fn from(value: aeron_subscription_t) -> Self
impl Send for AeronSubscription
impl Sync for AeronSubscription
Auto Trait Implementations§
impl Freeze for AeronSubscription
impl !RefUnwindSafe for AeronSubscription
impl Unpin for AeronSubscription
impl !UnwindSafe for AeronSubscription
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)