Skip to main content

AeronContext

Struct AeronContext 

Source
pub struct AeronContext<S: ResourceStorage<aeron_context_t> = CResource<aeron_context_t>> { /* private fields */ }

Implementations§

Source§

impl AeronContext<CResource<aeron_context_t>>

Source

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

Create a AeronContext struct and initialize with default values.

§Return

0 for success and -1 for error.

Source§

impl AeronContext

Source

pub fn request_driver_termination( directory: &CStr, token_buffer: &[u8], ) -> Result<i32, AeronCError>

Request the media driver terminates operation and closes all resources.

§Parameters
  • directory in which the media driver is running.
  • token_buffer containing the authentication token confirming the client is allowed to terminate the driver.
§Return
Source§

impl<S: ResourceStorage<aeron_context_t>> AeronContext<S>

Source

pub fn set_dir(&self, value: &CStr) -> Result<i32, AeronCError>

Source

pub unsafe fn get_dir(&self) -> &str

§Safety

The text points into native storage. A setter, poll or close can rewrite or free it, even through another clone of this handle. Use it straight away, for example to log or copy it, and do not hold it across any call that can change this resource. Use get_dir_owned() to keep a copy.

Source

pub fn get_dir_owned(&self) -> String

Copy the native text into an owned string. This allocates for nonempty text.

Source

pub fn set_driver_timeout_ms(&self, value: u64) -> Result<i32, AeronCError>

Source

pub fn get_driver_timeout_ms(&self) -> u64

Source

pub fn set_keepalive_interval_ns(&self, value: u64) -> Result<i32, AeronCError>

Source

pub fn get_keepalive_interval_ns(&self) -> u64

Source

pub fn set_resource_linger_duration_ns( &self, value: u64, ) -> Result<i32, AeronCError>

Source

pub fn get_resource_linger_duration_ns(&self) -> u64

Source

pub fn set_idle_sleep_duration_ns(&self, value: u64) -> Result<i32, AeronCError>

Source

pub fn get_idle_sleep_duration_ns(&self) -> u64

Source

pub fn set_idle_strategy_init_args( &self, value: &CStr, ) -> Result<i32, AeronCError>

Source

pub unsafe fn get_idle_strategy_init_args(&self) -> &str

§Safety

The text points into native storage. A setter, poll or close can rewrite or free it, even through another clone of this handle. Use it straight away, for example to log or copy it, and do not hold it across any call that can change this resource. Use get_idle_strategy_init_args_owned() to keep a copy.

Source

pub fn get_idle_strategy_init_args_owned(&self) -> String

Copy the native text into an owned string. This allocates for nonempty text.

Source

pub fn set_idle_strategy(&self, value: &CStr) -> Result<i32, AeronCError>

Source

pub unsafe fn get_idle_strategy(&self) -> &str

§Safety

The text points into native storage. A setter, poll or close can rewrite or free it, even through another clone of this handle. Use it straight away, for example to log or copy it, and do not hold it across any call that can change this resource. Use get_idle_strategy_owned() to keep a copy.

Source

pub fn get_idle_strategy_owned(&self) -> String

Copy the native text into an owned string. This allocates for nonempty text.

Source

pub fn set_pre_touch_mapped_memory( &self, value: bool, ) -> Result<i32, AeronCError>

Source

pub fn get_pre_touch_mapped_memory(&self) -> bool

Source

pub fn set_client_name(&self, value: &CStr) -> Result<i32, AeronCError>

Source

pub unsafe fn get_client_name(&self) -> &str

§Safety

The text points into native storage. A setter, poll or close can rewrite or free it, even through another clone of this handle. Use it straight away, for example to log or copy it, and do not hold it across any call that can change this resource. Use get_client_name_owned() to keep a copy.

Source

pub fn get_client_name_owned(&self) -> String

Copy the native text into an owned string. This allocates for nonempty text.

Source

pub fn set_error_handler<AeronErrorHandlerHandlerImpl: AeronErrorHandlerCallback + Send + 'static>( &self, handler: Option<AeronErrorHandlerHandlerImpl>, ) -> Result<Option<SharedHandler<AeronErrorHandlerHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_error_handler(&self) -> aeron_error_handler_t

Source

pub fn get_error_handler_clientd(&self) -> *mut c_void

Source

pub fn set_publication_error_frame_handler<AeronPublicationErrorFrameHandlerHandlerImpl: AeronPublicationErrorFrameHandlerCallback + Send + 'static>( &self, handler: Option<AeronPublicationErrorFrameHandlerHandlerImpl>, ) -> Result<Option<SharedHandler<AeronPublicationErrorFrameHandlerHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_publication_error_frame_handler( &self, ) -> aeron_publication_error_frame_handler_t

Source

pub fn get_publication_error_frame_handler_clientd(&self) -> *mut c_void

Source

pub fn set_on_new_publication<AeronNewPublicationHandlerImpl: AeronNewPublicationCallback + Send + 'static>( &self, handler: Option<AeronNewPublicationHandlerImpl>, ) -> Result<Option<SharedHandler<AeronNewPublicationHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_on_new_publication(&self) -> aeron_on_new_publication_t

Source

pub fn get_on_new_publication_clientd(&self) -> *mut c_void

Source

pub fn set_on_new_exclusive_publication<AeronNewPublicationHandlerImpl: AeronNewPublicationCallback + Send + 'static>( &self, handler: Option<AeronNewPublicationHandlerImpl>, ) -> Result<Option<SharedHandler<AeronNewPublicationHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_on_new_exclusive_publication(&self) -> aeron_on_new_publication_t

Source

pub fn get_on_new_exclusive_publication_clientd(&self) -> *mut c_void

Source

pub fn set_on_new_subscription<AeronNewSubscriptionHandlerImpl: AeronNewSubscriptionCallback + Send + 'static>( &self, handler: Option<AeronNewSubscriptionHandlerImpl>, ) -> Result<Option<SharedHandler<AeronNewSubscriptionHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_on_new_subscription(&self) -> aeron_on_new_subscription_t

Source

pub fn get_on_new_subscription_clientd(&self) -> *mut c_void

Source

pub fn set_on_available_counter<AeronAvailableCounterHandlerImpl: AeronAvailableCounterCallback + Send + 'static>( &self, handler: Option<AeronAvailableCounterHandlerImpl>, ) -> Result<Option<SharedHandler<AeronAvailableCounterHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_on_available_counter(&self) -> aeron_on_available_counter_t

Source

pub fn get_on_available_counter_clientd(&self) -> *mut c_void

Source

pub fn set_on_unavailable_counter<AeronUnavailableCounterHandlerImpl: AeronUnavailableCounterCallback + Send + 'static>( &self, handler: Option<AeronUnavailableCounterHandlerImpl>, ) -> Result<Option<SharedHandler<AeronUnavailableCounterHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_on_unavailable_counter(&self) -> aeron_on_unavailable_counter_t

Source

pub fn get_on_unavailable_counter_clientd(&self) -> *mut c_void

Source

pub fn set_on_close_client<AeronCloseClientHandlerImpl: AeronCloseClientCallback + Send + 'static>( &self, handler: Option<AeronCloseClientHandlerImpl>, ) -> Result<Option<SharedHandler<AeronCloseClientHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_on_close_client(&self) -> aeron_on_close_client_t

Source

pub fn get_on_close_client_clientd(&self) -> *mut c_void

Source

pub fn set_use_conductor_agent_invoker( &self, value: bool, ) -> Result<i32, AeronCError>

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

Source

pub fn get_use_conductor_agent_invoker(&self) -> bool

Source

pub fn set_agent_on_start_function<AeronAgentStartFuncHandlerImpl: AeronAgentStartFuncCallback + Send + 'static>( &self, value: Option<AeronAgentStartFuncHandlerImpl>, ) -> Result<Option<SharedHandler<AeronAgentStartFuncHandlerImpl>>, AeronCError>

An owned wrapper keeps the callback alive until C cleanup finishes. A borrowed wrapper returns an error before changing C, because it cannot keep a callback alive. Dropping the handler does not unregister the callback. Returns the SharedHandler so you can access its state. You can pass a closure with a matching signature.

Source

pub fn get_agent_on_start_function(&self) -> aeron_agent_on_start_func_t

Source

pub fn get_agent_on_start_state(&self) -> *mut c_void

Source

pub fn as_ref(&self) -> Ref<'_, Self>

Borrow this handle without cloning its owner.

Source

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

Source

pub unsafe fn get_inner_mut(&self) -> &mut aeron_context_t

Mutable access to the underlying C struct, minted from &self: nothing prevents two live &mut at once, so the caller must ensure exclusive access for the lifetime of the returned reference.

§Safety

No other reference (& or &mut) to the underlying struct may be alive while the returned &mut is in use.

Source

pub unsafe fn get_inner_ref(&self) -> &aeron_context_t

Borrow the native struct.

§Safety

No Rust or native call may mutate the struct while this reference is alive. Shared wrappers also require coordination with other threads.

Source§

impl AeronContext

Source

pub unsafe fn from_ptr( ptr: *mut aeron_context_t, ) -> AeronContext<Borrowed<aeron_context_t>>

Borrow a native pointer without taking ownership.

§Safety

The pointer must be non-null. It and its parents must remain live for every use. Calls must follow Aeron’s threading and aliasing rules.

Source§

impl<S: ResourceStorage<aeron_context_t>> AeronContext<S>

Source

pub fn set_driver_timeout(&self, value: Duration) -> Result<i32, AeronCError>

Set a duration. Millisecond settings round fractional milliseconds up. Returns an error if the value exceeds Aeron’s signed nanosecond clock range.

Source

pub fn get_driver_timeout(&self) -> Duration

Read the configured duration.

Source

pub fn set_keepalive_interval( &self, value: Duration, ) -> Result<i32, AeronCError>

Set a duration. Millisecond settings round fractional milliseconds up. Returns an error if the value exceeds Aeron’s signed nanosecond clock range.

Source

pub fn get_keepalive_interval(&self) -> Duration

Read the configured duration.

Source

pub fn set_resource_linger_duration( &self, value: Duration, ) -> Result<i32, AeronCError>

Set a duration. Millisecond settings round fractional milliseconds up. Returns an error if the value exceeds Aeron’s signed nanosecond clock range.

Source

pub fn get_resource_linger_duration(&self) -> Duration

Read the configured duration.

Source

pub fn set_idle_sleep_duration( &self, value: Duration, ) -> Result<i32, AeronCError>

Set a duration. Millisecond settings round fractional milliseconds up. Returns an error if the value exceeds Aeron’s signed nanosecond clock range.

Source

pub fn get_idle_sleep_duration(&self) -> Duration

Read the configured duration.

Source§

impl AeronContext

Source

pub fn set_idle_strategy_kind( &self, kind: AeronIdleStrategyKind, ) -> Result<i32, AeronCError>

Typed variant of Self::set_idle_strategy: configures the conductor’s idle strategy without stringly-typed names, setting coherent default init args (override afterwards with Self::set_idle_strategy_init_args if needed).

This is how to make the conductor busier: Self::set_idle_sleep_duration_ns does not change its sleep once the context exists, only how often it checks timeouts.

Trait Implementations§

Source§

impl<S: Clone + ResourceStorage<aeron_context_t>> Clone for AeronContext<S>

Source§

fn clone(&self) -> AeronContext<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: ResourceStorage<aeron_context_t>> Debug for AeronContext<S>

Source§

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

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

impl<S: ResourceStorage<aeron_context_t>> From<&AeronContext<S>> for *mut aeron_context_t

Source§

fn from(value: &AeronContext<S>) -> Self

Converts to this type from the input type.
Source§

impl<S: ResourceStorage<aeron_context_t>> From<AeronContext<S>> for *mut aeron_context_t

Source§

fn from(value: AeronContext<S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<S> Freeze for AeronContext<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for AeronContext<S>
where S: RefUnwindSafe,

§

impl<S> Send for AeronContext<S>
where S: Send,

§

impl<S> Sync for AeronContext<S>
where S: Sync,

§

impl<S> Unpin for AeronContext<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for AeronContext<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for AeronContext<S>
where S: UnwindSafe,

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.