Struct Context

Source
pub struct Context { /* private fields */ }
Expand description

Context provides configuration for the {@link Aeron} class via the {@link Aeron::Aeron} or {@link Aeron::connect} methods and its overloads. It gives applications some control over the interactions with the Aeron Media Driver. It can also set up error handling as well as application callbacks for connection information from the Media Driver.

Implementations§

Source§

impl Context

Source

pub fn new() -> Self

Source

pub fn conclude(&mut self) -> &Self

Source

pub fn agent_name(&self) -> String

Source

pub fn set_agent_name(&mut self, name: &str)

Source

pub fn set_aeron_dir(&mut self, directory: String) -> &Self

Set the directory that the Aeron client will use to communicate with the media driver.

@param directory to use @return reference to this Context instance

Source

pub fn aeron_dir(&self) -> String

Source

pub fn cnc_file_name(&self) -> String

Return the path to the CnC file used by the Aeron client for communication with the media driver.

@return path of the CnC file

Source

pub fn set_error_handler( &mut self, handler: impl ErrorHandler + Send + 'static, ) -> &Self

Set the handler for exceptions from the Aeron client.

@param handler called when exceptions arise @return reference to this Context instance

@see default_error_handler for how the default behavior is handled

Source

pub fn error_handler(&self) -> Box<dyn ErrorHandler + Send + 'static>

Source

pub fn set_new_publication_handler( &mut self, handler: impl OnNewPublication + 'static, ) -> &Self

Set the handler for successful Aeron::add_publication notifications.

@param handler called when add is completed successfully @return reference to this Context instance

Source

pub fn new_publication_handler(&self) -> Box<dyn OnNewPublication>

Source

pub fn set_new_exclusive_publication_handler( &mut self, handler: Box<dyn OnNewPublication>, ) -> &Self

Set the handler for successful Aeron::add_exclusive_publication notifications.

If not set, then will use new_publication_handler instead.

@param handler called when add is completed successfully @return reference to this Context instance

Source

pub fn new_exclusive_publication_handler(&self) -> Box<dyn OnNewPublication>

Source

pub fn set_new_subscription_handler( &mut self, handler: impl OnNewSubscription + 'static, ) -> &Self

Set the handler for successful Aeron::add_subscription notifications.

@param handler called when add is completed successfully @return reference to this Context instance

Source

pub fn new_subscription_handler(&self) -> Box<dyn OnNewSubscription>

Source

pub fn set_available_image_handler( &mut self, handler: impl OnAvailableImage + 'static, ) -> &Self

Set the handler for available image notifications.

@param handler called when event occurs @return reference to this Context instance

Source

pub fn available_image_handler(&self) -> Box<dyn OnAvailableImage>

Source

pub fn set_unavailable_image_handler( &mut self, handler: impl OnUnavailableImage + 'static, ) -> &Self

Set the handler for inactive image notifications.

@param handler called when event occurs @return reference to this Context instance

Source

pub fn unavailable_image_handler(&self) -> Box<dyn OnUnavailableImage>

Source

pub fn set_available_counter_handler( &mut self, handler: impl OnAvailableCounter + 'static, ) -> &Self

Set the handler for available counter notifications.

@param handler called when event occurs @return reference to this Context instance

Source

pub fn available_counter_handler(&self) -> Box<dyn OnAvailableCounter>

Source

pub fn set_unavailable_counter_handler( &mut self, handler: impl OnUnavailableCounter + 'static, ) -> &Self

Set the handler for inactive counter notifications.

@param handler called when event occurs @return reference to this Context instance

Source

pub fn unavailable_counter_handler(&self) -> Box<dyn OnUnavailableCounter>

Source

pub fn set_close_client_handler( &mut self, handler: impl OnCloseClient + 'static, ) -> &Self

Set the handler to be called when the Aeron client is closed and not longer active.

@param handler to be called when the Aeron client is closed. @return reference to this Context instance.

Source

pub fn close_client_handler(&self) -> Box<dyn OnCloseClient>

Source

pub fn set_media_driver_timeout(&mut self, value: Moment) -> &Self

Set the amount of time, in milliseconds, that this client will wait until it determines the Media Driver is unavailable. When this happens a DriverTimeoutException will be generated for the error handler.

@param value Number of milliseconds. @return reference to this Context instance @see errorHandler

Source

pub fn media_driver_timeout(&self) -> Moment

Get the amount of time, in milliseconds, that this client will wait until it determines the Media Driver is unavailable. When this happens a DriverTimeoutException will be generated for the error handler.

@return value in number of milliseconds. @see errorHandler

Source

pub fn set_resource_linger_timeout(&mut self, value: Moment) -> &Self

Set the amount of time, in milliseconds, that this client will to linger inactive connections and internal arrays before they are free’d.

@param value Number of milliseconds. @return reference to this Context instance

Source

pub fn resource_linger_timeout(&self) -> Moment

Source

pub fn set_use_conductor_agent_invoker( &mut self, use_conductor_agent_invoker: bool, ) -> &Self

Set whether to use an invoker to control the conductor agent or spawn a thread.

@param use_conductor_agent_invoker to use an invoker or not. @return reference to this Context instance

Source

pub fn use_conductor_agent_invoker(&self) -> bool

Source

pub fn set_pre_touch_mapped_memory( &mut self, pre_touch_mapped_memory: bool, ) -> &Self

Set whether memory mapped files should be pre-touched so they are pre-loaded to avoid later page faults.

@param pre_touch_mapped_memory true to pre-touch memory otherwise false. @return reference to this Context instance

Source

pub fn pre_touch_mapped_memory(&self) -> bool

Source

pub fn request_driver_termination( directory: &str, token_buffer: &[u8], ) -> Result<(), AeronError>

Source

pub fn tmp_dir() -> String

Source

pub fn get_user_name() -> String

Source

pub fn default_aeron_path_parent() -> String

Source

pub fn default_aeron_path() -> String

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

Returns a duplicate 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 Default for Context

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Context

§

impl !RefUnwindSafe for Context

§

impl !Send for Context

§

impl !Sync for Context

§

impl Unpin for Context

§

impl !UnwindSafe for Context

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, dest: *mut u8)

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V