Struct rusteron_media_driver::AeronSubscription

source ·
pub struct AeronSubscription { /* private fields */ }

Implementations§

source§

impl AeronSubscription

source

pub fn new_zeroed() -> Result<Self, AeronCError>

source

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.

source

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.

source

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.

source

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.

source

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

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

§Parameters
  • subscription to get the constants for.

  • constants structure to fill in with the constants

§Return

0 for success and -1 for error.

source

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.

source

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.

source

pub fn image_at_index(&self, index: usize) -> AeronImage

Return the image at the given index.

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
  • index for the image.
§Return

image at the given index or NULL if no image exists.

source

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.

source

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.

source

pub fn image_release(&self, image: &AeronImage) -> Result<i32, AeronCError>

Release the given image and relinquish desire to use the image directly.

Note: Subscriptions are not threadsafe and should not be shared between subscribers.

§Parameters
  • subscription that image is part of.

  • image to release

§Return

0 for success and -1 for error.

source

pub fn is_closed(&self) -> bool

Is the subscription closed.

§Return

true if it has been closed otherwise false.

source

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

source

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.

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 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.

source

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_Sockaddrs

§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.

source

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.

source

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

source§

impl AeronSubscription

Trait Implementations§

source§

impl Clone for AeronSubscription

source§

fn clone(&self) -> AeronSubscription

Returns a copy 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 AeronSubscription

source§

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

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

impl Deref for AeronSubscription

source§

type Target = aeron_subscription_stct

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl From<&AeronSubscription> for *mut aeron_subscription_t

source§

fn from(value: &AeronSubscription) -> Self

Converts to this type from the input type.
source§

impl From<*const aeron_subscription_stct> for AeronSubscription

source§

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

Converts to this type from the input type.
source§

impl From<*mut aeron_subscription_stct> for AeronSubscription

source§

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

Converts to this type from the input type.
source§

impl From<AeronSubscription> for *mut aeron_subscription_t

source§

fn from(value: AeronSubscription) -> Self

Converts to this type from the input type.
source§

impl From<AeronSubscription> for aeron_subscription_t

source§

fn from(value: AeronSubscription) -> Self

Converts to this type from the input type.
source§

impl From<aeron_subscription_stct> for AeronSubscription

source§

fn from(value: aeron_subscription_t) -> Self

Converts to this type from the input type.
§

impl Send for AeronSubscription

§

impl Sync for AeronSubscription

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<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.