pub struct AeronContext<S: ResourceStorage<aeron_context_t> = CResource<aeron_context_t>> { /* private fields */ }Implementations§
Source§impl AeronContext<CResource<aeron_context_t>>
impl AeronContext<CResource<aeron_context_t>>
Sourcepub fn new() -> Result<Self, AeronCError>
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
impl AeronContext
Sourcepub fn request_driver_termination(
directory: &CStr,
token_buffer: &[u8],
) -> Result<i32, AeronCError>
pub fn request_driver_termination( directory: &CStr, token_buffer: &[u8], ) -> Result<i32, AeronCError>
Source§impl<S: ResourceStorage<aeron_context_t>> AeronContext<S>
impl<S: ResourceStorage<aeron_context_t>> AeronContext<S>
pub fn set_dir(&self, value: &CStr) -> Result<i32, AeronCError>
Sourcepub unsafe fn get_dir(&self) -> &str
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.
Sourcepub fn get_dir_owned(&self) -> String
pub fn get_dir_owned(&self) -> String
Copy the native text into an owned string. This allocates for nonempty text.
pub fn set_driver_timeout_ms(&self, value: u64) -> Result<i32, AeronCError>
pub fn get_driver_timeout_ms(&self) -> u64
pub fn set_keepalive_interval_ns(&self, value: u64) -> Result<i32, AeronCError>
pub fn get_keepalive_interval_ns(&self) -> u64
pub fn set_resource_linger_duration_ns( &self, value: u64, ) -> Result<i32, AeronCError>
pub fn get_resource_linger_duration_ns(&self) -> u64
pub fn set_idle_sleep_duration_ns(&self, value: u64) -> Result<i32, AeronCError>
pub fn get_idle_sleep_duration_ns(&self) -> u64
pub fn set_idle_strategy_init_args( &self, value: &CStr, ) -> Result<i32, AeronCError>
Sourcepub unsafe fn get_idle_strategy_init_args(&self) -> &str
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.
Sourcepub fn get_idle_strategy_init_args_owned(&self) -> String
pub fn get_idle_strategy_init_args_owned(&self) -> String
Copy the native text into an owned string. This allocates for nonempty text.
pub fn set_idle_strategy(&self, value: &CStr) -> Result<i32, AeronCError>
Sourcepub unsafe fn get_idle_strategy(&self) -> &str
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.
Sourcepub fn get_idle_strategy_owned(&self) -> String
pub fn get_idle_strategy_owned(&self) -> String
Copy the native text into an owned string. This allocates for nonempty text.
pub fn set_pre_touch_mapped_memory( &self, value: bool, ) -> Result<i32, AeronCError>
pub fn get_pre_touch_mapped_memory(&self) -> bool
pub fn set_client_name(&self, value: &CStr) -> Result<i32, AeronCError>
Sourcepub unsafe fn get_client_name(&self) -> &str
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.
Sourcepub fn get_client_name_owned(&self) -> String
pub fn get_client_name_owned(&self) -> String
Copy the native text into an owned string. This allocates for nonempty text.
Sourcepub fn set_error_handler<AeronErrorHandlerHandlerImpl: AeronErrorHandlerCallback + Send + 'static>(
&self,
handler: Option<AeronErrorHandlerHandlerImpl>,
) -> Result<Option<SharedHandler<AeronErrorHandlerHandlerImpl>>, AeronCError>
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.
pub fn get_error_handler(&self) -> aeron_error_handler_t
pub fn get_error_handler_clientd(&self) -> *mut c_void
Sourcepub fn set_publication_error_frame_handler<AeronPublicationErrorFrameHandlerHandlerImpl: AeronPublicationErrorFrameHandlerCallback + Send + 'static>(
&self,
handler: Option<AeronPublicationErrorFrameHandlerHandlerImpl>,
) -> Result<Option<SharedHandler<AeronPublicationErrorFrameHandlerHandlerImpl>>, AeronCError>
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.
pub fn get_publication_error_frame_handler( &self, ) -> aeron_publication_error_frame_handler_t
pub fn get_publication_error_frame_handler_clientd(&self) -> *mut c_void
Sourcepub fn set_on_new_publication<AeronNewPublicationHandlerImpl: AeronNewPublicationCallback + Send + 'static>(
&self,
handler: Option<AeronNewPublicationHandlerImpl>,
) -> Result<Option<SharedHandler<AeronNewPublicationHandlerImpl>>, AeronCError>
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.
pub fn get_on_new_publication(&self) -> aeron_on_new_publication_t
pub fn get_on_new_publication_clientd(&self) -> *mut c_void
Sourcepub fn set_on_new_exclusive_publication<AeronNewPublicationHandlerImpl: AeronNewPublicationCallback + Send + 'static>(
&self,
handler: Option<AeronNewPublicationHandlerImpl>,
) -> Result<Option<SharedHandler<AeronNewPublicationHandlerImpl>>, AeronCError>
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.
pub fn get_on_new_exclusive_publication(&self) -> aeron_on_new_publication_t
pub fn get_on_new_exclusive_publication_clientd(&self) -> *mut c_void
Sourcepub fn set_on_new_subscription<AeronNewSubscriptionHandlerImpl: AeronNewSubscriptionCallback + Send + 'static>(
&self,
handler: Option<AeronNewSubscriptionHandlerImpl>,
) -> Result<Option<SharedHandler<AeronNewSubscriptionHandlerImpl>>, AeronCError>
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.
pub fn get_on_new_subscription(&self) -> aeron_on_new_subscription_t
pub fn get_on_new_subscription_clientd(&self) -> *mut c_void
Sourcepub fn set_on_available_counter<AeronAvailableCounterHandlerImpl: AeronAvailableCounterCallback + Send + 'static>(
&self,
handler: Option<AeronAvailableCounterHandlerImpl>,
) -> Result<Option<SharedHandler<AeronAvailableCounterHandlerImpl>>, AeronCError>
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.
pub fn get_on_available_counter(&self) -> aeron_on_available_counter_t
pub fn get_on_available_counter_clientd(&self) -> *mut c_void
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.
Sourcepub fn set_on_close_client<AeronCloseClientHandlerImpl: AeronCloseClientCallback + Send + 'static>(
&self,
handler: Option<AeronCloseClientHandlerImpl>,
) -> Result<Option<SharedHandler<AeronCloseClientHandlerImpl>>, AeronCError>
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.
pub fn get_on_close_client(&self) -> aeron_on_close_client_t
pub fn get_on_close_client_clientd(&self) -> *mut c_void
Sourcepub fn set_use_conductor_agent_invoker(
&self,
value: bool,
) -> Result<i32, AeronCError>
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.
pub fn get_use_conductor_agent_invoker(&self) -> bool
Sourcepub fn set_agent_on_start_function<AeronAgentStartFuncHandlerImpl: AeronAgentStartFuncCallback + Send + 'static>(
&self,
value: Option<AeronAgentStartFuncHandlerImpl>,
) -> Result<Option<SharedHandler<AeronAgentStartFuncHandlerImpl>>, AeronCError>
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.
pub fn get_agent_on_start_function(&self) -> aeron_agent_on_start_func_t
pub fn get_agent_on_start_state(&self) -> *mut c_void
pub fn get_inner(&self) -> *mut aeron_context_t
Sourcepub unsafe fn get_inner_mut(&self) -> &mut aeron_context_t
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.
Sourcepub unsafe fn get_inner_ref(&self) -> &aeron_context_t
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
impl AeronContext
Sourcepub unsafe fn from_ptr(
ptr: *mut aeron_context_t,
) -> AeronContext<Borrowed<aeron_context_t>>
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>
impl<S: ResourceStorage<aeron_context_t>> AeronContext<S>
Sourcepub fn set_driver_timeout(&self, value: Duration) -> Result<i32, AeronCError>
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.
Sourcepub fn get_driver_timeout(&self) -> Duration
pub fn get_driver_timeout(&self) -> Duration
Read the configured duration.
Sourcepub fn set_keepalive_interval(
&self,
value: Duration,
) -> Result<i32, AeronCError>
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.
Sourcepub fn get_keepalive_interval(&self) -> Duration
pub fn get_keepalive_interval(&self) -> Duration
Read the configured duration.
Sourcepub fn set_resource_linger_duration(
&self,
value: Duration,
) -> Result<i32, AeronCError>
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.
Sourcepub fn get_resource_linger_duration(&self) -> Duration
pub fn get_resource_linger_duration(&self) -> Duration
Read the configured duration.
Sourcepub fn set_idle_sleep_duration(
&self,
value: Duration,
) -> Result<i32, AeronCError>
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.
Sourcepub fn get_idle_sleep_duration(&self) -> Duration
pub fn get_idle_sleep_duration(&self) -> Duration
Read the configured duration.
Source§impl AeronContext
impl AeronContext
Sourcepub fn set_idle_strategy_kind(
&self,
kind: AeronIdleStrategyKind,
) -> Result<i32, AeronCError>
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>
impl<S: Clone + ResourceStorage<aeron_context_t>> Clone for AeronContext<S>
Source§fn clone(&self) -> AeronContext<S>
fn clone(&self) -> AeronContext<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more