[][src]Struct aeron_rs::aeron::Aeron

pub struct Aeron { /* fields omitted */ }

Aeron entry point for communicating to the Media Driver for creating {@link Publication}s and {@link Subscription}s. Use a {@link Context} to configure the Aeron object.

A client application requires only one Aeron object per Media Driver.

Methods

impl Aeron[src]

pub fn new(context: Context) -> Result<Self, AeronError>[src]

Create an Aeron instance and connect to the media driver.

Threads required for interacting with the media driver are created and managed within the Aeron instance.

@param context for configuration of the client.

pub fn is_closed(&self) -> bool[src]

Indicate if the instance is closed and can not longer be used.

@return true is the instance is closed and can no longer be used, otherwise false.

pub fn connect_ctx(context: Context) -> Arc<Result<Aeron, AeronError>>[src]

Create an Aeron instance and connect to the media driver.

Threads required for interacting with the media driver are created and managed within the Aeron instance.

@param context for configuration of the client. @return the new Aeron instance connected to the Media Driver.

pub fn connect() -> Arc<Result<Aeron, AeronError>>[src]

Create an Aeron instance and connect to the media driver.

Threads required for interacting with the media driver are created and managed within the Aeron instance.

@return the new Aeron instance connected to the Media Driver.

pub fn add_publication(
    &mut self,
    channel: CString,
    stream_id: i32
) -> Result<i64, AeronError>
[src]

Add a {@link Publication} for publishing messages to subscribers

This function returns immediately and does not wait for the response from the media driver. The returned registration id is to be used to determine the status of the command with the media driver.

@param channel for sending the messages known to the media layer. @param stream_id within the channel scope. @return registration id for the publication

pub fn find_publication(
    &mut self,
    registration_id: i64
) -> Result<Arc<Mutex<Publication>>, AeronError>
[src]

Retrieve the Publication associated with the given registration_id.

This method is non-blocking.

The value returned is dependent on what has occurred with respect to the media driver:

  • If the registration_id is unknown, then AeronError is returned.
  • If the media driver has not answered the add command, then AeronError is returned.
  • If the media driver has successfully added the Publication then what is returned is the Publication.
  • If the media driver has returned an error, this method will bring back the error returned.

@see Aeron::add_publication

@param registration_id of the Publication returned by Aeron::add_publication @return Publication associated with the registration_id

pub fn add_exclusive_publication(
    &mut self,
    channel: CString,
    stream_id: i32
) -> Result<i64, AeronError>
[src]

Add an {@link ExclusivePublication} for publishing messages to subscribers from a single thread.

@param channel for sending the messages known to the media layer. @param stream_id within the channel scope. @return registration id for the publication

pub fn find_exclusive_publication(
    &mut self,
    registration_id: i64
) -> Result<Arc<Mutex<ExclusivePublication>>, AeronError>
[src]

Retrieve the ExclusivePublication associated with the given registration_id.

This method is non-blocking.

The value returned is dependent on what has occurred with respect to the media driver:

  • If the registration_id is unknown, then a nullptr is returned.
  • If the media driver has not answered the add command, then a nullptr is returned.
  • If the media driver has successfully added the ExclusivePublication then what is returned is the ExclusivePublication.
  • If the media driver has returned an error, this method will throw the error returned.

@see Aeron::add_exclusive_publication

@param registration_id of the ExclusivePublication returned by Aeron::add_exclusive_publication @return ExclusivePublication associated with the registration_id

pub fn add_subscription(
    &mut self,
    channel: CString,
    stream_id: i32
) -> Result<i64, AeronError>
[src]

Add a new {@link Subscription} for subscribing to messages from publishers.

This function returns immediately and does not wait for the response from the media driver. The returned registration id is to be used to determine the status of the command with the media driver.

@param channel for receiving the messages known to the media layer. @param stream_id within the channel scope. @return registration id for the subscription

pub fn add_subscription_opt(
    &mut self,
    channel: CString,
    stream_id: i32,
    on_available_image_handler: OnAvailableImage,
    on_unavailable_image_handler: OnUnavailableImage
) -> Result<i64, AeronError>
[src]

Add a new {@link Subscription} for subscribing to messages from publishers.

This method will override the default handlers from the {@link Context}.

@param channel for receiving the messages known to the media layer. @param stream_id within the channel scope. @param availableImageHandler called when {@link Image}s become available for consumption. @param unavailableImageHandler called when {@link Image}s go unavailable for consumption. @return registration id for the subscription

pub fn find_subscription(
    &mut self,
    registration_id: i64
) -> Result<Arc<Mutex<Subscription>>, AeronError>
[src]

Retrieve the Subscription associated with the given registration_id.

This method is non-blocking.

The value returned is dependent on what has occurred with respect to the media driver:

  • If the registration_id is unknown, then a nullptr is returned.
  • If the media driver has not answered the add command, then a nullptr is returned.
  • If the media driver has successfully added the Subscription then what is returned is the Subscription.
  • If the media driver has returned an error, this method will throw the error returned.

@see Aeron::add_subscription

@param registration_id of the Subscription returned by Aeron::add_subscription @return Subscription associated with the registration_id

pub fn next_correlation_id(&self) -> Result<i64, AeronError>[src]

Generate the next correlation id that is unique for the connected Media Driver.

This is useful generating correlation identifiers for pairing requests with responses in a clients own application protocol.

This method is thread safe and will work across processes that all use the same media driver.

@return next correlation id that is unique for the Media Driver.

pub fn add_counter(
    &mut self,
    type_id: i32,
    key_buffer: &[u8],
    label: &str
) -> Result<i64, AeronError>
[src]

Allocate a counter on the media driver and return a {@link Counter} for it.

@param type_id for the counter. @param key_buffer containing the optional key for the counter. @param key_length of the key in the key_buffer. @param label for the counter. @return registration id for the Counter

pub fn find_counter(
    &mut self,
    registration_id: i64
) -> Result<Arc<Counter>, AeronError>
[src]

Retrieve the Counter associated with the given registration_id.

This method is non-blocking.

The value returned is dependent on what has occurred with respect to the media driver:

  • If the registration_id is unknown, then a AeronError is returned.
  • If the media driver has not answered the add command, then a AeronError is returned.
  • If the media driver has successfully added the Counter then what is returned is the Counter.
  • If the media driver has returned an error, this method will return the error.

@see Aeron::addCounter

@param registration_id of the Counter returned by Aeron::addCounter @return Counter associated with the registration_id

pub fn add_available_counter_handler(&mut self, handler: OnAvailableCounter)[src]

Add a handler to the list to be called when a counter becomes available.

@param handler to be added to the available counters list.

pub fn remove_available_counter_handler(&mut self, handler: OnAvailableCounter)[src]

Remove a handler from the list to be called when a counter becomes available.

@param handler to be removed from the available counters list.

pub fn add_unavailable_counter_handler(&mut self, handler: OnUnavailableCounter)[src]

Add a handler to the list to be called when a counter becomes unavailable.

@param handler to be added to the unavailable counters list.

pub fn remove_unavailable_counter_handler(
    &mut self,
    handler: OnUnavailableCounter
)
[src]

Remove a handler from the list to be called when a counter becomes unavailable.

@param handler to be removed from the unavailable counters list.

pub fn add_close_client_handler(&mut self, handler: OnCloseClient)[src]

Add a handler to the list to be called when the client is closed.

@param handler to be added to the close client handlers list.

pub fn remove_close_client_handler(&mut self, handler: OnCloseClient)[src]

Remove a handler from the list to be called when the client is closed.

@param handler to be removed from the close client handlers list.

pub fn conductor_agent_invoker(&self) -> &AgentInvoker<ClientConductor>[src]

Return the AgentInvoker for the client conductor.

@return AgentInvoker for the conductor.

pub fn uses_agent_invoker(&self) -> bool[src]

Return whether the AgentInvoker is used or not.

@return true if AgentInvoker used or false if not.

pub fn counters_reader(&self) -> Result<Arc<CountersReader>, AeronError>[src]

Get the CountersReader for the Aeron media driver counters.

@return CountersReader for the Aeron media driver in use.

pub fn client_id(&self) -> i64[src]

Get the client identity that has been allocated for communicating with the media driver.

@return the client identity that has been allocated for communicating with the media driver.

pub fn context(&self) -> &Context[src]

Get the Aeron Context object used in construction of the Aeron instance.

@return Context instance in use.

pub fn version(&self) -> String[src]

Return the static version and build string for the binary library.

@return static version and build string for the binary library.

pub fn map_cnc_file(context: &Context) -> Result<MemoryMappedFile, AeronError>[src]

Trait Implementations

impl Drop for Aeron[src]

Auto Trait Implementations

impl !RefUnwindSafe for Aeron

impl !Send for Aeron

impl !Sync for Aeron

impl Unpin for Aeron

impl !UnwindSafe for Aeron

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.