pub struct Aeron { /* private fields */ }Implementations§
Source§impl Aeron
impl Aeron
Sourcepub fn async_add_counter(
&self,
type_id: i32,
key_buffer: &[u8],
label_buffer: &str,
) -> Result<AeronAsyncAddCounter, AeronCError>
pub fn async_add_counter( &self, type_id: i32, key_buffer: &[u8], label_buffer: &str, ) -> Result<AeronAsyncAddCounter, AeronCError>
§Handler lifetime and async close
If this call takes a Handler, the C close for the resulting resource
(e.g. aeron_subscription_close) is asynchronous — the conductor thread
may still invoke the handler’s callback (e.g. on_available_image) after
close()/drop has already returned on the calling thread. Releasing the
handler’s value immediately on close would risk a use-after-free from that
still-in-flight callback.
To make this safe without requiring the caller to track it, this method
stores a clone of the owning Aeron client as a dependency on the
resource being created — which transitively keeps every Handler clone
already registered as a dependency of that resource alive for as long as
the client itself lives, regardless of when the resource closes. No manual
release() call is needed.
This differs from the Aeron C++ wrapper, which instead frees the handler
as the final step of on_cmd_close_subscription on the conductor thread —
i.e. it ties the handler’s lifetime to the close completing, not to the
client. Rusteron’s approach is simpler and avoids needing a conductor-side
hook, but it means handler dependencies accumulate on the client’s
dependency list for the client’s lifetime (they are small Arc clones, one
per call, and are only dropped when the client itself drops).
Source§impl Aeron
impl Aeron
Sourcepub fn add_counter(
&self,
type_id: i32,
key_buffer: &[u8],
label_buffer: &str,
timeout: Duration,
) -> Result<AeronCounter, AeronCError>
pub fn add_counter( &self, type_id: i32, key_buffer: &[u8], label_buffer: &str, timeout: Duration, ) -> Result<AeronCounter, AeronCError>
Blocking convenience wrapper around the async add operation.
Convenience for examples and tests only. It blocks the calling thread
in a busy-poll loop until the resource is available or timeout elapses. In
production, prefer the async_add_* variant and drive its poll() from your
own event loop rather than blocking on a single operation.
§Production pattern (pseudo code)
// Don't block — drive the async poller from your loop
let poller = client.async_add_*(...)?;
loop {
if let Some(resource) = poller.poll()? {
break; // ready
}
do_other_work(); // service other subscriptions, timers, etc.
}See poll_blocking on the async poller for the same caveat.
Source§impl Aeron
impl Aeron
Sourcepub fn async_add_exclusive_publication(
&self,
uri: &CStr,
stream_id: i32,
) -> Result<AeronAsyncAddExclusivePublication, AeronCError>
pub fn async_add_exclusive_publication( &self, uri: &CStr, stream_id: i32, ) -> Result<AeronAsyncAddExclusivePublication, AeronCError>
§Handler lifetime and async close
If this call takes a Handler, the C close for the resulting resource
(e.g. aeron_subscription_close) is asynchronous — the conductor thread
may still invoke the handler’s callback (e.g. on_available_image) after
close()/drop has already returned on the calling thread. Releasing the
handler’s value immediately on close would risk a use-after-free from that
still-in-flight callback.
To make this safe without requiring the caller to track it, this method
stores a clone of the owning Aeron client as a dependency on the
resource being created — which transitively keeps every Handler clone
already registered as a dependency of that resource alive for as long as
the client itself lives, regardless of when the resource closes. No manual
release() call is needed.
This differs from the Aeron C++ wrapper, which instead frees the handler
as the final step of on_cmd_close_subscription on the conductor thread —
i.e. it ties the handler’s lifetime to the close completing, not to the
client. Rusteron’s approach is simpler and avoids needing a conductor-side
hook, but it means handler dependencies accumulate on the client’s
dependency list for the client’s lifetime (they are small Arc clones, one
per call, and are only dropped when the client itself drops).
Source§impl Aeron
impl Aeron
Sourcepub fn add_exclusive_publication(
&self,
uri: &CStr,
stream_id: i32,
timeout: Duration,
) -> Result<AeronExclusivePublication, AeronCError>
pub fn add_exclusive_publication( &self, uri: &CStr, stream_id: i32, timeout: Duration, ) -> Result<AeronExclusivePublication, AeronCError>
Blocking convenience wrapper around the async add operation.
Convenience for examples and tests only. It blocks the calling thread
in a busy-poll loop until the resource is available or timeout elapses. In
production, prefer the async_add_* variant and drive its poll() from your
own event loop rather than blocking on a single operation.
§Production pattern (pseudo code)
// Don't block — drive the async poller from your loop
let poller = client.async_add_*(...)?;
loop {
if let Some(resource) = poller.poll()? {
break; // ready
}
do_other_work(); // service other subscriptions, timers, etc.
}See poll_blocking on the async poller for the same caveat.
Source§impl Aeron
impl Aeron
Sourcepub fn async_add_publication(
&self,
uri: &CStr,
stream_id: i32,
) -> Result<AeronAsyncAddPublication, AeronCError>
pub fn async_add_publication( &self, uri: &CStr, stream_id: i32, ) -> Result<AeronAsyncAddPublication, AeronCError>
§Handler lifetime and async close
If this call takes a Handler, the C close for the resulting resource
(e.g. aeron_subscription_close) is asynchronous — the conductor thread
may still invoke the handler’s callback (e.g. on_available_image) after
close()/drop has already returned on the calling thread. Releasing the
handler’s value immediately on close would risk a use-after-free from that
still-in-flight callback.
To make this safe without requiring the caller to track it, this method
stores a clone of the owning Aeron client as a dependency on the
resource being created — which transitively keeps every Handler clone
already registered as a dependency of that resource alive for as long as
the client itself lives, regardless of when the resource closes. No manual
release() call is needed.
This differs from the Aeron C++ wrapper, which instead frees the handler
as the final step of on_cmd_close_subscription on the conductor thread —
i.e. it ties the handler’s lifetime to the close completing, not to the
client. Rusteron’s approach is simpler and avoids needing a conductor-side
hook, but it means handler dependencies accumulate on the client’s
dependency list for the client’s lifetime (they are small Arc clones, one
per call, and are only dropped when the client itself drops).
Source§impl Aeron
impl Aeron
Sourcepub fn add_publication(
&self,
uri: &CStr,
stream_id: i32,
timeout: Duration,
) -> Result<AeronPublication, AeronCError>
pub fn add_publication( &self, uri: &CStr, stream_id: i32, timeout: Duration, ) -> Result<AeronPublication, AeronCError>
Blocking convenience wrapper around the async add operation.
Convenience for examples and tests only. It blocks the calling thread
in a busy-poll loop until the resource is available or timeout elapses. In
production, prefer the async_add_* variant and drive its poll() from your
own event loop rather than blocking on a single operation.
§Production pattern (pseudo code)
// Don't block — drive the async poller from your loop
let poller = client.async_add_*(...)?;
loop {
if let Some(resource) = poller.poll()? {
break; // ready
}
do_other_work(); // service other subscriptions, timers, etc.
}See poll_blocking on the async poller for the same caveat.
Source§impl Aeron
impl Aeron
Sourcepub fn async_add_subscription<AeronAvailableImageHandlerImpl: AeronAvailableImageCallback + 'static, AeronUnavailableImageHandlerImpl: AeronUnavailableImageCallback + 'static>(
&self,
uri: &CStr,
stream_id: i32,
on_available_image_handler: Option<&Handler<AeronAvailableImageHandlerImpl>>,
on_unavailable_image_handler: Option<&Handler<AeronUnavailableImageHandlerImpl>>,
) -> Result<AeronAsyncAddSubscription, AeronCError>
pub fn async_add_subscription<AeronAvailableImageHandlerImpl: AeronAvailableImageCallback + 'static, AeronUnavailableImageHandlerImpl: AeronUnavailableImageCallback + 'static>( &self, uri: &CStr, stream_id: i32, on_available_image_handler: Option<&Handler<AeronAvailableImageHandlerImpl>>, on_unavailable_image_handler: Option<&Handler<AeronUnavailableImageHandlerImpl>>, ) -> Result<AeronAsyncAddSubscription, AeronCError>
§Handler lifetime and async close
If this call takes a Handler, the C close for the resulting resource
(e.g. aeron_subscription_close) is asynchronous — the conductor thread
may still invoke the handler’s callback (e.g. on_available_image) after
close()/drop has already returned on the calling thread. Releasing the
handler’s value immediately on close would risk a use-after-free from that
still-in-flight callback.
To make this safe without requiring the caller to track it, this method
stores a clone of the owning Aeron client as a dependency on the
resource being created — which transitively keeps every Handler clone
already registered as a dependency of that resource alive for as long as
the client itself lives, regardless of when the resource closes. No manual
release() call is needed.
This differs from the Aeron C++ wrapper, which instead frees the handler
as the final step of on_cmd_close_subscription on the conductor thread —
i.e. it ties the handler’s lifetime to the close completing, not to the
client. Rusteron’s approach is simpler and avoids needing a conductor-side
hook, but it means handler dependencies accumulate on the client’s
dependency list for the client’s lifetime (they are small Arc clones, one
per call, and are only dropped when the client itself drops).
Source§impl Aeron
impl Aeron
Sourcepub fn add_subscription<AeronAvailableImageHandlerImpl: AeronAvailableImageCallback + 'static, AeronUnavailableImageHandlerImpl: AeronUnavailableImageCallback + 'static>(
&self,
uri: &CStr,
stream_id: i32,
on_available_image_handler: Option<&Handler<AeronAvailableImageHandlerImpl>>,
on_unavailable_image_handler: Option<&Handler<AeronUnavailableImageHandlerImpl>>,
timeout: Duration,
) -> Result<AeronSubscription, AeronCError>
pub fn add_subscription<AeronAvailableImageHandlerImpl: AeronAvailableImageCallback + 'static, AeronUnavailableImageHandlerImpl: AeronUnavailableImageCallback + 'static>( &self, uri: &CStr, stream_id: i32, on_available_image_handler: Option<&Handler<AeronAvailableImageHandlerImpl>>, on_unavailable_image_handler: Option<&Handler<AeronUnavailableImageHandlerImpl>>, timeout: Duration, ) -> Result<AeronSubscription, AeronCError>
Blocking convenience wrapper around the async add operation.
Convenience for examples and tests only. It blocks the calling thread
in a busy-poll loop until the resource is available or timeout elapses. In
production, prefer the async_add_* variant and drive its poll() from your
own event loop rather than blocking on a single operation.
§Production pattern (pseudo code)
// Don't block — drive the async poller from your loop
let poller = client.async_add_*(...)?;
loop {
if let Some(resource) = poller.poll()? {
break; // ready
}
do_other_work(); // service other subscriptions, timers, etc.
}See poll_blocking on the async poller for the same caveat.
Source§impl Aeron
impl Aeron
Sourcepub fn new(context: &AeronContext) -> Result<Self, AeronCError>
pub fn new(context: &AeronContext) -> Result<Self, AeronCError>
pub fn free(ptr: *mut c_void)
Sourcepub fn fprintf(
src_: &CStr,
line_: u64,
stream: *mut c_void,
format: &CStr,
) -> Result<i32, AeronCError>
pub fn fprintf( src_: &CStr, line_: u64, stream: *mut c_void, format: &CStr, ) -> Result<i32, AeronCError>
Global file writing method, allows for interposition
Sourcepub fn set_fprintf_handler(
fn_: aeron_fprintf_handler_t,
) -> aeron_fprintf_handler_t
pub fn set_fprintf_handler( fn_: aeron_fprintf_handler_t, ) -> aeron_fprintf_handler_t
update the fprintf_handler, return previously installed handler
Sourcepub fn get_fprintf_handler() -> aeron_fprintf_handler_t
pub fn get_fprintf_handler() -> aeron_fprintf_handler_t
return the fprintf_handler
Sourcepub fn start(&self) -> Result<i32, AeronCError>
pub fn start(&self) -> Result<i32, AeronCError>
Start an Aeron. This may spawn a thread for the Client Conductor.
§Return
0 for success and -1 for error.
Sourcepub fn main_do_work(&self) -> Result<i32, AeronCError>
pub fn main_do_work(&self) -> Result<i32, AeronCError>
Call the Conductor main do_work duty cycle once.
Client must have been created with use conductor invoker set to true.
§Return
0 for success and -1 for error.
Sourcepub fn main_idle_strategy(&self, work_count: c_int)
pub fn main_idle_strategy(&self, work_count: c_int)
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Determines if the client has been closed, e.g. via a driver timeout. Don’t call this method after calling aeron_close as that will have already freed the associated memory.
§Return
true if it has been closed, false otherwise.
Sourcepub fn print_counters(
&self,
stream_out: Option<unsafe extern "C" fn(arg1: *const c_char)>,
)
pub fn print_counters( &self, stream_out: Option<unsafe extern "C" fn(arg1: *const c_char)>, )
Call stream_out to print the counter labels and values.
§Parameters
stream_outto call for each label and value.
Sourcepub fn context(&self) -> AeronContext
pub fn context(&self) -> AeronContext
Return the AeronContext that is in use by the given client.
§Return
the AeronContext for the given client or NULL for an error.
Sourcepub fn next_correlation_id(&self) -> i64
pub fn next_correlation_id(&self) -> i64
Sourcepub fn async_add_publication_cancel(
&self,
async_: &AeronAsyncAddPublication,
) -> Result<i32, AeronCError>
pub fn async_add_publication_cancel( &self, async_: &AeronAsyncAddPublication, ) -> Result<i32, AeronCError>
Cancel an in-progress aeron_async_add_publication operation.
Will eventually free the given instance. If a publication gets created by
the time cancellation happens, it will get removed.AeronAsyncAddPublication
Note: The above guarantees only apply when a call to this method succeeds, i.e. return value is zero. If a
return value is non-zero the operation won’t be canceled and the instance
won’t be freed.AeronAsyncAddPublication
§Return
0 for success or -1 for error.
Sourcepub fn async_remove_publication<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>(
&self,
registration_id: i64,
on_complete: Option<AeronNotificationHandlerImpl>,
) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
pub fn async_remove_publication<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>( &self, registration_id: i64, on_complete: Option<AeronNotificationHandlerImpl>, ) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
Asynchronously remove a publication.
If there is an AeronPublication object for that publication, it will get closed and freed.
§Parameters
-
registration_idof the publication to be removed. -
on_completeoptional callback to execute once the publication has been removed. This may happen on a separate thread, so the caller should ensure that clientd has the appropriate lifetime. Use NULL if not needed. -
on_complete_clientdparameter to pass to the on_complete callback.
§Return
0 for success or -1 for error.
The callback is retained by the C client; this resource keeps it alive automatically.
Returns the created Handler for optional state access — safe to ignore. Closures with a matching signature are accepted directly.
Sourcepub fn async_add_exclusive_publication_cancel(
&self,
async_: &AeronAsyncAddExclusivePublication,
) -> Result<i32, AeronCError>
pub fn async_add_exclusive_publication_cancel( &self, async_: &AeronAsyncAddExclusivePublication, ) -> Result<i32, AeronCError>
Cancel an in-progress aeron_async_add_exclusive_publication operation.
Will eventually free the given instance. If a publication gets
created by the time cancellation happens, it will get removed.AeronAsyncAddExclusivePublication
Note: The above guarantees only apply when a call to this method succeeds, i.e. return value is zero. If a
return value is non-zero the operation won’t be canceled and the
instance won’t be freed.AeronAsyncAddExclusivePublication
§Return
0 for success or -1 for error.
Sourcepub fn async_remove_exclusive_publication<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>(
&self,
registration_id: i64,
on_complete: Option<AeronNotificationHandlerImpl>,
) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
pub fn async_remove_exclusive_publication<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>( &self, registration_id: i64, on_complete: Option<AeronNotificationHandlerImpl>, ) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
Asynchronously remove an exclusive publication.
If there is an AeronExclusivePublication object for that publication, it will get closed and freed.
§Parameters
-
registration_idof the exclusive publication to be removed. -
on_completeoptional callback to execute once the exclusive publication has been removed. This may happen on a separate thread, so the caller should ensure that clientd has the appropriate lifetime. Use NULL if not needed. -
on_complete_clientdparameter to pass to the on_complete callback.
§Return
0 for success or -1 for error.
The callback is retained by the C client; this resource keeps it alive automatically.
Returns the created Handler for optional state access — safe to ignore. Closures with a matching signature are accepted directly.
Sourcepub fn async_add_subscription_cancel(
&self,
async_: &AeronAsyncAddSubscription,
) -> Result<i32, AeronCError>
pub fn async_add_subscription_cancel( &self, async_: &AeronAsyncAddSubscription, ) -> Result<i32, AeronCError>
Cancel an in-progress aeron_async_add_subscription operation.
Will eventually free the given instance. If a subscription gets created
by the time cancellation happens, it will get removed.AeronAsyncAddSubscription
Note: The above guarantees only apply when a call to this method succeeds, i.e. return value is zero. If a
return value is non-zero the operation won’t be canceled and the instance
won’t be freed.AeronAsyncAddSubscription
§Return
0 for success or -1 for error.
Sourcepub fn async_remove_subscription<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>(
&self,
registration_id: i64,
on_complete: Option<AeronNotificationHandlerImpl>,
) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
pub fn async_remove_subscription<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>( &self, registration_id: i64, on_complete: Option<AeronNotificationHandlerImpl>, ) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
Asynchronously remove a subscription.
If there is an AeronSubscription object for that subscription, it will get closed and freed.
§Parameters
-
registration_idof the subscription to be removed. -
on_completeoptional callback to execute once the subscription has been removed. This may happen on a separate thread, so the caller should ensure that clientd has the appropriate lifetime. Use NULL if not needed. -
on_complete_clientdparameter to pass to the on_complete callback.
§Return
0 for success or -1 for error.
The callback is retained by the C client; this resource keeps it alive automatically.
Returns the created Handler for optional state access — safe to ignore. Closures with a matching signature are accepted directly.
Sourcepub fn counters_reader(&self) -> AeronCountersReader
pub fn counters_reader(&self) -> AeronCountersReader
Return a reference to the counters reader of the given client.
The AeronCountersReader is maintained by the client. And should not be freed.
§Return
AeronCountersReader or NULL for error.
Sourcepub fn async_add_counter_cancel(
&self,
async_: &AeronAsyncAddCounter,
) -> Result<i32, AeronCError>
pub fn async_add_counter_cancel( &self, async_: &AeronAsyncAddCounter, ) -> Result<i32, AeronCError>
Cancel an in-progress aeron_async_add_counter operation. Not applicable to
aeron_async_add_static_counter, i.e. attempt to cancel static counter will fail with an error.
Will eventually free the given instance. If a counter gets created by the time
cancellation happens, it will get removed.AeronAsyncAddCounter
Note: The above guarantees only apply when a call to this method succeeds, i.e. return value is zero. If a
return value is non-zero the operation won’t be canceled and the instance
won’t be freed.AeronAsyncAddCounter
§Return
0 for success or -1 for error.
Sourcepub fn async_remove_counter<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>(
&self,
registration_id: i64,
on_complete: Option<AeronNotificationHandlerImpl>,
) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
pub fn async_remove_counter<AeronNotificationHandlerImpl: AeronNotificationCallback + 'static>( &self, registration_id: i64, on_complete: Option<AeronNotificationHandlerImpl>, ) -> Result<Option<Handler<AeronNotificationHandlerImpl>>, AeronCError>
Asynchronously remove a counter. Not applicable to static counters.
If there is an AeronCounter object for that counter, it will get closed and freed.
§Parameters
-
registration_idof the counter to be removed. -
on_completeoptional callback to execute once the counter has been removed. This may happen on a separate thread, so the caller should ensure that clientd has the appropriate lifetime. Use NULL if not needed. -
on_complete_clientdparameter to pass to the on_complete callback.
§Return
0 for success or -1 for error.
The callback is retained by the C client; this resource keeps it alive automatically.
Returns the created Handler for optional state access — safe to ignore. Closures with a matching signature are accepted directly.
Sourcepub fn add_available_counter_handler(
&self,
pair: &AeronAvailableCounterPair,
) -> Result<i32, AeronCError>
pub fn add_available_counter_handler( &self, pair: &AeronAvailableCounterPair, ) -> Result<i32, AeronCError>
Sourcepub fn remove_available_counter_handler(
&self,
pair: &AeronAvailableCounterPair,
) -> Result<i32, AeronCError>
pub fn remove_available_counter_handler( &self, pair: &AeronAvailableCounterPair, ) -> Result<i32, AeronCError>
Remove a previously added handler to be called when a new counter becomes unavailable or goes away.
NOTE: This function blocks until the handler is removed by the client conductor thread.
§Parameters
pairholding the handler to call and a clientd to pass when called.
§Return
0 for success and -1 for error
Sourcepub fn add_close_handler(
&self,
pair: &AeronCloseClientPair,
) -> Result<i32, AeronCError>
pub fn add_close_handler( &self, pair: &AeronCloseClientPair, ) -> Result<i32, AeronCError>
Sourcepub fn remove_close_handler(
&self,
pair: &AeronCloseClientPair,
) -> Result<i32, AeronCError>
pub fn remove_close_handler( &self, pair: &AeronCloseClientPair, ) -> Result<i32, AeronCError>
Sourcepub fn version_full() -> &'static str
pub fn version_full() -> &'static str
Return full version and build string.
§Return
full version and build string. SAFETY: this is static for performance reasons, so you should not store this without copying it!!
Sourcepub fn version_text() -> &'static str
pub fn version_text() -> &'static str
Return version text.
§Return
version text. SAFETY: this is static for performance reasons, so you should not store this without copying it!!
Sourcepub fn version_major() -> Result<i32, AeronCError>
pub fn version_major() -> Result<i32, AeronCError>
Sourcepub fn version_minor() -> Result<i32, AeronCError>
pub fn version_minor() -> Result<i32, AeronCError>
Sourcepub fn version_patch() -> Result<i32, AeronCError>
pub fn version_patch() -> Result<i32, AeronCError>
Sourcepub fn version_gitsha() -> &'static str
pub fn version_gitsha() -> &'static str
Return the git sha for the current build.
§Return
git version SAFETY: this is static for performance reasons, so you should not store this without copying it!!
Sourcepub fn nano_clock() -> i64
pub fn nano_clock() -> i64
Return time in nanoseconds for machine. Is not wall clock time.
§Return
nanoseconds since epoch for machine.
Sourcepub fn epoch_clock() -> i64
pub fn epoch_clock() -> i64
Sourcepub fn is_driver_active(
dirname: &CStr,
timeout_ms: i64,
log_func: aeron_log_func_t,
) -> bool
pub fn is_driver_active( dirname: &CStr, timeout_ms: i64, log_func: aeron_log_func_t, ) -> bool
Sourcepub fn properties_buffer_load(buffer: &CStr) -> Result<i32, AeronCError>
pub fn properties_buffer_load(buffer: &CStr) -> Result<i32, AeronCError>
Sourcepub fn properties_file_load(filename: &CStr) -> Result<i32, AeronCError>
pub fn properties_file_load(filename: &CStr) -> Result<i32, AeronCError>
Sourcepub fn properties_http_load(url: &CStr) -> Result<i32, AeronCError>
pub fn properties_http_load(url: &CStr) -> Result<i32, AeronCError>
Sourcepub fn properties_load(url_or_filename: &CStr) -> Result<i32, AeronCError>
pub fn properties_load(url_or_filename: &CStr) -> Result<i32, AeronCError>
Load properties based on URL or filename. If string contains file or http URL, it will attempt to load properties from a file or http as indicated. If not a URL, then it will try to load the string as a filename.
§Parameters
url_or_filenameto load properties from.
§Return
0 for success and -1 for error.
Sourcepub fn errcode() -> Result<i32, AeronCError>
pub fn errcode() -> Result<i32, AeronCError>
Return current aeron error code (errno) for calling thread.
§Return
aeron error code for calling thread.
Sourcepub fn errmsg() -> &'static str
pub fn errmsg() -> &'static str
Return the current aeron error message for calling thread.
§Return
aeron error message for calling thread. SAFETY: this is static for performance reasons, so you should not store this without copying it!!
Sourcepub fn default_path(path: &mut [u8]) -> Result<i32, AeronCError>
pub fn default_path(path: &mut [u8]) -> Result<i32, AeronCError>
Get the default path used by the Aeron media driver.
§Parameters
-
pathbuffer to store the path. -
path_lengthspace available in the buffer
§Return
-1 if there is an issue or the number of bytes written to path excluding the terminator \0. If this
is equal to or greater than the path_length then the path has been truncated.
pub fn randomised_int32() -> i32
pub fn thread_set_name(name: &CStr) -> Result<i32, AeronCError>
pub fn thread_get_name(name_buf: &mut [u8]) -> Result<i32, AeronCError>
pub fn nano_sleep(nanoseconds: u64)
pub fn micro_sleep(microseconds: c_uint)
pub fn thread_set_affinity( name: &CStr, cpu_affinity_no: u8, ) -> Result<i32, AeronCError>
pub fn mutex_init(mutex: *mut aeron_mutex_t) -> Result<i32, AeronCError>
pub fn mutex_destroy(mutex: *mut aeron_mutex_t) -> Result<i32, AeronCError>
pub fn mutex_lock(mutex: *mut aeron_mutex_t) -> Result<i32, AeronCError>
pub fn mutex_unlock(mutex: *mut aeron_mutex_t) -> Result<i32, AeronCError>
pub fn semantic_version_compose(major: u8, minor: u8, patch: u8) -> i32
pub fn semantic_version_major(version: i32) -> u8
pub fn semantic_version_minor(version: i32) -> u8
pub fn semantic_version_patch(version: i32) -> u8
Sourcepub fn delete_directory(dirname: &CStr) -> Result<i32, AeronCError>
pub fn delete_directory(dirname: &CStr) -> Result<i32, AeronCError>
Sourcepub fn set_thread_affinity_on_start(state: *mut c_void, role_name: &CStr)
pub fn set_thread_affinity_on_start(state: *mut c_void, role_name: &CStr)
Affinity setting function that complies with the aeron_agent_on_start_func_t structure that can
be used as an agent start function. The state should be the AeronDriverContext* and the function
will match the values conductor/sender/receiver/native resource agent thread names and use the respective
configuration options from the AeronDriverContext.
§Parameters
-
stateclient information passed to function, should be theAeronDriverContext*. -
role_namename of the role specified on the agent.
pub fn set_socket_non_blocking(fd: aeron_socket_t) -> Result<i32, AeronCError>
pub fn socket(domain: c_int, type_: c_int, protocol: c_int) -> aeron_socket_t
pub fn close_socket(socket: aeron_socket_t)
pub fn bind( fd: aeron_socket_t, address: &Sockaddr, address_length: socklen_t, ) -> Result<i32, AeronCError>
pub fn net_init() -> Result<i32, AeronCError>
pub fn getsockopt( fd: aeron_socket_t, level: c_int, optname: c_int, optval: *mut c_void, optlen: *mut socklen_t, ) -> Result<i32, AeronCError>
pub fn setsockopt( fd: aeron_socket_t, level: c_int, optname: c_int, optval: *const c_void, optlen: socklen_t, ) -> Result<i32, AeronCError>
pub fn sendmsg(fd: aeron_socket_t, msghdr: &Msghdr, flags: c_int) -> isize
pub fn send( fd: aeron_socket_t, buf: *const c_void, len: usize, flags: c_int, ) -> isize
pub fn recvmsg(fd: aeron_socket_t, msghdr: &Msghdr, flags: c_int) -> isize
pub fn res_header_entry_length( res: *mut c_void, remaining: usize, ) -> Result<i32, AeronCError>
pub fn logbuffer_check_term_length(term_length: u64) -> Result<i32, AeronCError>
pub fn logbuffer_check_page_size(page_size: u64) -> Result<i32, AeronCError>
pub fn is_directory(path: &CStr) -> Result<i32, AeronCError>
pub fn mkdir_recursive( pathname: &CStr, permission: c_int, ) -> Result<i32, AeronCError>
pub fn msync(addr: *mut c_void, length: usize) -> Result<i32, AeronCError>
pub fn delete_file(path: &CStr) -> Result<i32, AeronCError>
Sourcepub fn realpath(path: &CStr, resolved_path: &mut [u8]) -> &'static str
pub fn realpath(path: &CStr, resolved_path: &mut [u8]) -> &'static str
SAFETY: this is static for performance reasons, so you should not store this without copying it!!
Sourcepub fn tmpdir(path: &mut [u8]) -> &'static str
pub fn tmpdir(path: &mut [u8]) -> &'static str
SAFETY: this is static for performance reasons, so you should not store this without copying it!!
pub fn file_exists(path: &CStr) -> bool
pub fn ftell(stream: *mut c_void) -> i64
Sourcepub fn open_file_append(path: &CStr) -> *mut c_void
pub fn open_file_append(path: &CStr) -> *mut c_void
pub fn file_length(path: &CStr) -> i64
pub fn usable_fs_space(path: &CStr) -> u64
pub fn usable_fs_space_disabled(path: &CStr) -> u64
pub fn temp_filename(filename: &mut [u8]) -> usize
pub fn file_resolve( parent: &CStr, child: &CStr, buffer: &mut [u8], ) -> Result<i32, AeronCError>
pub fn flow_control_parse_tagged_options( options_length: usize, options: &CStr, flow_control_options: &AeronFlowControlTaggedOptions, ) -> Result<i32, AeronCError>
pub fn flow_control_calculate_retransmission_length( resend_length: usize, term_buffer_length: usize, term_offset: usize, retransmit_receiver_window_multiple: usize, ) -> usize
pub fn agent_on_start_load(name: &CStr) -> aeron_agent_on_start_func_t
pub fn set_errno(errcode: c_int)
pub fn err_set( errcode: c_int, function: &CStr, filename: &CStr, line_number: c_int, format: &CStr, )
pub fn err_append( function: &CStr, filename: &CStr, line_number: c_int, format: &CStr, )
pub fn err_clear()
pub fn parse_port_range( range_str: &CStr, low_port: &mut u16, high_port: &mut u16, ) -> Result<i32, AeronCError>
pub fn config_parse_inferable_boolean( inferable_boolean: &CStr, def: aeron_inferable_boolean_t, ) -> aeron_inferable_boolean_t
pub fn format_date(str_: &mut [u8], timestamp: i64)
pub fn format_number_to_locale( value: c_longlong, buffer: &mut [u8], ) -> *mut c_char
pub fn format_to_hex(str_: &mut [u8], data: &[u8])
pub fn digit_count(value: u32) -> Result<i32, AeronCError>
pub fn ip_addr_resolver( host: &CStr, sockaddr: &SockaddrStorage, family_hint: c_int, protocol: c_int, ) -> Result<i32, AeronCError>
pub fn udp_port_resolver( port_str: &CStr, optional: bool, ) -> Result<i32, AeronCError>
pub fn try_parse_ipv4(host: &CStr, sockaddr: &SockaddrStorage) -> bool
pub fn ipv4_addr_resolver( host: &CStr, protocol: c_int, sockaddr: &SockaddrStorage, ) -> Result<i32, AeronCError>
pub fn try_parse_ipv6(host: &CStr, sockaddr: &SockaddrStorage) -> bool
pub fn ipv6_addr_resolver( host: &CStr, protocol: c_int, sockaddr: &SockaddrStorage, ) -> Result<i32, AeronCError>
pub fn lookup_interfaces<AeronIfaddrFuncHandlerImpl: AeronIfaddrFuncCallback + 'static>( func: Option<&Handler<AeronIfaddrFuncHandlerImpl>>, ) -> Result<i32, AeronCError>
pub fn lookup_interfaces_from_ifaddrs<AeronIfaddrFuncHandlerImpl: AeronIfaddrFuncCallback + 'static>( func: Option<&Handler<AeronIfaddrFuncHandlerImpl>>, ifaddrs: &Ifaddrs, ) -> Result<i32, AeronCError>
pub fn set_getifaddrs( get_func: aeron_getifaddrs_func_t, free_func: aeron_freeifaddrs_func_t, )
pub fn interface_parse_and_resolve( interface_str: &CStr, sockaddr: &SockaddrStorage, ) -> Result<usize, AeronCError>
pub fn ipv4_netmask_from_prefixlen(prefixlen: usize) -> u32
pub fn find_interface( family: c_int, interface_str: &CStr, if_addr: &SockaddrStorage, if_index: *mut c_uint, ) -> Result<i32, AeronCError>
pub fn find_unicast_interface( family: c_int, interface_str: &CStr, interface_addr: &SockaddrStorage, interface_index: *mut c_uint, ) -> Result<i32, AeronCError>
pub fn format_source_identity( buffer: &mut [u8], addr: &SockaddrStorage, ) -> Result<i32, AeronCError>
pub fn netutil_get_so_buf_lengths( default_so_rcvbuf: &mut usize, default_so_sndbuf: &mut usize, ) -> Result<i32, AeronCError>
pub fn parse_named_interface( interface_str: &CStr, out: &AeronNamedInterface, ) -> Result<i32, AeronCError>
pub fn parse_size64(str_: &CStr) -> Result<u64, AeronCError>
pub fn format_size64(value: u64, buffer: &mut [u8]) -> Result<i32, AeronCError>
pub fn parse_duration_ns(str_: &CStr) -> Result<u64, AeronCError>
pub fn format_duration_ns( duration_ns: u64, buffer: &mut [u8], ) -> Result<i32, AeronCError>
pub fn parse_bool(str_: &CStr, def: bool) -> bool
pub fn address_split( address_str: &CStr, parsed_address: &AeronParsedAddress, ) -> Result<i32, AeronCError>
pub fn interface_split( interface_str: &CStr, parsed_interface: &AeronParsedInterface, ) -> Result<i32, AeronCError>
pub fn parse_get_line( line: &mut [u8], buffer: &CStr, ) -> Result<i32, AeronCError>
pub fn config_prop_warning(name: &CStr, str_: &CStr)
pub fn config_parse_uint64( name: &CStr, str_: &CStr, def: u64, min: u64, max: u64, ) -> u64
pub fn config_parse_int32( name: &CStr, str_: &CStr, def: i32, min: i32, max: i32, ) -> i32
pub fn config_parse_int64( name: &CStr, str_: &CStr, def: i64, min: i64, max: i64, ) -> i64
pub fn config_parse_uint32( name: &CStr, str_: &CStr, def: u32, min: u32, max: u32, ) -> u32
pub fn config_parse_size64( name: &CStr, str_: &CStr, def: u64, min: u64, max: u64, ) -> u64
pub fn config_parse_duration_ns( name: &CStr, str_: &CStr, def: u64, min: u64, max: u64, ) -> u64
pub fn get_inner(&self) -> *mut aeron_t
Sourcepub unsafe fn get_inner_mut(&self) -> &mut aeron_t
pub unsafe fn get_inner_mut(&self) -> &mut aeron_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.
pub fn get_inner_ref(&self) -> &aeron_t
Source§impl Aeron
impl Aeron
Sourcepub fn close(self) -> Result<(), AeronCError>
pub fn close(self) -> Result<(), AeronCError>
Releases this handle and closes the C client once the last reference drops.
The C client owns and frees every child resource (publications,
subscriptions, counters) when it closes, so while children or clones
are alive this is deferred — equivalent to drop — and the surviving
handles remain fully usable. The C close runs when the final
reference (child or clone) is released.
Sourcepub unsafe fn close_now(self) -> Result<(), AeronCError>
pub unsafe fn close_now(self) -> Result<(), AeronCError>
Closes the C client immediately, even if children or clones are alive.
Clones of this handle are safe afterwards (their shared pointer is nulled). Child handles are not:
§Safety
The C client frees every child resource (publications, subscriptions,
counters) during this call, so surviving child handles dangle. Any use
is use-after-free — including their Drop, which calls the C close
on the freed pointer (double free). You must std::mem::forget every
surviving child, or never return (e.g. std::process::exit). Prefer
Self::close, which defers until the last reference drops.
Source§impl Aeron
impl Aeron
Sourcepub fn connect(dir: Option<&str>) -> Result<Aeron, AeronCError>
pub fn connect(dir: Option<&str>) -> Result<Aeron, AeronCError>
Connect to a media driver in one call: context, client, and conductor start.
dir is the media driver directory (None uses the aeron default). For tuned
setups — error handlers, driver timeout, idle strategy — build the
AeronContext yourself and use Aeron::new.
Sourcepub fn connect_default() -> Result<Aeron, AeronCError>
pub fn connect_default() -> Result<Aeron, AeronCError>
Connect to a media driver in the default aeron directory. Equivalent to
Self::connect(None), but reads more naturally at the call site.
Sourcepub fn connect_dir(dir: &str) -> Result<Aeron, AeronCError>
pub fn connect_dir(dir: &str) -> Result<Aeron, AeronCError>
Connect to a media driver in dir. Equivalent to
Self::connect(Some(dir)).