pub struct AeronCountersReader { /* private fields */ }Implementations§
Source§impl AeronCountersReader
impl AeronCountersReader
Sourcepub fn new_zeroed_on_heap() -> Self
pub fn new_zeroed_on_heap() -> Self
creates zeroed struct where the underlying c struct is on the heap
Sourcepub fn new_zeroed_on_stack() -> Self
pub fn new_zeroed_on_stack() -> Self
creates zeroed struct where the underlying c struct is on the stack (Use with care)
Sourcepub fn get_buffers(
&self,
buffers: &AeronCountersReaderBuffers,
) -> Result<i32, AeronCError>
pub fn get_buffers( &self, buffers: &AeronCountersReaderBuffers, ) -> Result<i32, AeronCError>
Sourcepub fn foreach_counter<AeronCountersReaderForeachCounterFuncHandlerImpl: AeronCountersReaderForeachCounterFuncCallback>(
&self,
func: Option<&Handler<AeronCountersReaderForeachCounterFuncHandlerImpl>>,
)
pub fn foreach_counter<AeronCountersReaderForeachCounterFuncHandlerImpl: AeronCountersReaderForeachCounterFuncCallback>( &self, func: Option<&Handler<AeronCountersReaderForeachCounterFuncHandlerImpl>>, )
Iterate over the counters in the counters_reader and call the given function for each counter.
§Parameters
functo call for each counter.clientdto pass for each call to func.
Sourcepub fn foreach_counter_fn<AeronCountersReaderForeachCounterFuncHandlerImpl: FnMut(i64, i32, i32, &[u8], &str)>(
&self,
func: AeronCountersReaderForeachCounterFuncHandlerImpl,
)
pub fn foreach_counter_fn<AeronCountersReaderForeachCounterFuncHandlerImpl: FnMut(i64, i32, i32, &[u8], &str)>( &self, func: AeronCountersReaderForeachCounterFuncHandlerImpl, )
Iterate over the counters in the counters_reader and call the given function for each counter.
§Parameters
functo call for each counter.clientdto pass for each call to func.
Stack-borrowed closure (_fn variant): the FnMut closure lives on the
caller’s stack and is borrowed for this call only. The callback fires
synchronously inside the call, so nothing is heap-allocated, nothing is stored,
and the closure may borrow local state. Prefer this over the retained
Handler-based form on the hot path; only generated for callbacks the C
client does not retain (i.e. not stored for later firing).
§Panics
A panic in the closure is caught so the C call can finish, then passed to the caller once it returns
Sourcepub fn find_by_type_id_and_registration_id(
&self,
type_id: i32,
registration_id: i64,
) -> i32
pub fn find_by_type_id_and_registration_id( &self, type_id: i32, registration_id: i64, ) -> i32
Sourcepub fn max_counter_id(&self) -> i32
pub fn max_counter_id(&self) -> i32
Sourcepub fn counter_registration_id(
&self,
counter_id: i32,
) -> Result<i64, AeronCError>
pub fn counter_registration_id( &self, counter_id: i32, ) -> Result<i64, AeronCError>
Get the registration id assigned to a counter.
§Parameters
counter_idfor which the registration id is requested.registration_idpointer for value to be set on success.
Sourcepub fn counter_owner_id(&self, counter_id: i32) -> Result<i64, AeronCError>
pub fn counter_owner_id(&self, counter_id: i32) -> Result<i64, AeronCError>
Get the owner id assigned to a counter which will typically be the client id.
§Parameters
counter_idfor which the owner id is requested.owner_idpointer for value to be set on success.
Sourcepub fn counter_reference_id(&self, counter_id: i32) -> Result<i64, AeronCError>
pub fn counter_reference_id(&self, counter_id: i32) -> Result<i64, AeronCError>
Get the reference id assigned to a counter which will typically be the registration id of an associated Image, Subscription, Publication, etc.
§Parameters
counter_idfor which the reference id is requested.reference_idpointer for value to be set on success.
Sourcepub fn counter_state(&self, counter_id: i32) -> Result<i32, AeronCError>
pub fn counter_state(&self, counter_id: i32) -> Result<i32, AeronCError>
Get the state for a counter.
§Parameters
counter_idto findstateout pointer for the current state to be stored in.
Sourcepub fn counter_type_id(&self, counter_id: i32) -> Result<i32, AeronCError>
pub fn counter_type_id(&self, counter_id: i32) -> Result<i32, AeronCError>
Sourcepub fn counter_label(
&self,
counter_id: i32,
buffer: &mut [u8],
) -> Result<i32, AeronCError>
pub fn counter_label( &self, counter_id: i32, buffer: &mut [u8], ) -> Result<i32, AeronCError>
Sourcepub fn free_for_reuse_deadline_ms(
&self,
counter_id: i32,
) -> Result<i64, AeronCError>
pub fn free_for_reuse_deadline_ms( &self, counter_id: i32, ) -> Result<i64, AeronCError>
Get the free for reuse deadline (ms) for a counter.
§Parameters
counter_idto find.deadline_msoutput value to store the deadline.
Sourcepub fn aeron_archive_recording_pos_find_counter_id_by_recording_id(
&self,
recording_id: i64,
archive_id: i64,
) -> i32
pub fn aeron_archive_recording_pos_find_counter_id_by_recording_id( &self, recording_id: i64, archive_id: i64, ) -> i32
Sourcepub fn aeron_archive_recording_pos_find_counter_id_by_session_id(
&self,
session_id: i32,
archive_id: i64,
) -> i32
pub fn aeron_archive_recording_pos_find_counter_id_by_session_id( &self, session_id: i32, archive_id: i64, ) -> i32
Sourcepub fn aeron_archive_recording_pos_get_recording_id(
&self,
counter_id: i32,
) -> i64
pub fn aeron_archive_recording_pos_get_recording_id( &self, counter_id: i32, ) -> i64
Sourcepub fn aeron_archive_recording_pos_is_active(
&self,
counter_id: i32,
recording_id: i64,
) -> Result<bool, AeronCError>
pub fn aeron_archive_recording_pos_is_active( &self, counter_id: i32, recording_id: i64, ) -> Result<bool, AeronCError>
pub fn aeron_local_sockaddr_find_addrs( &self, channel_status_indicator_id: i32, address_vec: &AeronIovec, address_vec_len: usize, ) -> Result<i32, AeronCError>
pub fn get_inner(&self) -> *mut aeron_counters_reader_t
Sourcepub unsafe fn get_inner_mut(&self) -> &mut aeron_counters_reader_t
pub unsafe fn get_inner_mut(&self) -> &mut aeron_counters_reader_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_counters_reader_t
Source§impl AeronCountersReader
impl AeronCountersReader
Sourcepub const MAX_KEY_LENGTH: usize
pub const MAX_KEY_LENGTH: usize
Size of a counter key in bytes (112), same as Java’s CountersReader.MAX_KEY_LENGTH
Sourcepub fn find_by_type_id(
&self,
type_id: i32,
predicate: impl FnMut(&[u8]) -> bool,
) -> Option<i32>
pub fn find_by_type_id( &self, type_id: i32, predicate: impl FnMut(&[u8]) -> bool, ) -> Option<i32>
Find the first counter of type_id whose key matches predicate.
The type ids are the bindgen’d AERON_COUNTER_*_TYPE_ID constants; the key layout
is type-specific (see aeron_counters.h). Mirrors Java’s CountersReader lookups.
Sourcepub fn find_by_type_and_registration_id(
&self,
type_id: i32,
registration_id: i64,
) -> Option<i32>
pub fn find_by_type_and_registration_id( &self, type_id: i32, registration_id: i64, ) -> Option<i32>
Find the first counter of type_id keyed by registration_id, the layout used by
aeron’s per-stream counters (publisher limit/position, sender/receiver positions,
subscriber position). The key starts with the registration id as a little-endian
i64. Mirrors Java’s findCounterIdByRegistration-style helpers, e.g.:
let registration_id = publication.get_constants()?.registration_id;
let limit_counter = counters_reader
.find_by_type_and_registration_id(AERON_COUNTER_PUBLISHER_LIMIT_TYPE_ID as i32, registration_id);Sourcepub fn get_counter_label(
&self,
counter_id: i32,
max_length: usize,
) -> Result<String, AeronCError>
pub fn get_counter_label( &self, counter_id: i32, max_length: usize, ) -> Result<String, AeronCError>
Get the label for a counter.
param counters_reader that contains the counter
param counter_id to find
param buffer to store the counter in.
param buffer_length length of the output buffer
return -1 on failure, number of characters copied to buffer on success.
Sourcepub fn get_counter_label_into(
&self,
counter_id: i32,
dst: &mut String,
) -> Result<(), AeronCError>
pub fn get_counter_label_into( &self, counter_id: i32, dst: &mut String, ) -> Result<(), AeronCError>
Get the label for a counter.
Sourcepub fn get_counter_key(&self, counter_id: i32) -> Result<Vec<u8>, AeronCError>
pub fn get_counter_key(&self, counter_id: i32) -> Result<Vec<u8>, AeronCError>
Get a counter’s key: all Self::MAX_KEY_LENGTH bytes, zero padded
This also succeeds for a freed counter. To check a counter is live, also check
Self::counter_state and Self::counter_type_id
Sourcepub fn get_counter_key_into(
&self,
counter_id: i32,
dst: &mut Vec<u8>,
) -> Result<(), AeronCError>
pub fn get_counter_key_into( &self, counter_id: i32, dst: &mut Vec<u8>, ) -> Result<(), AeronCError>
Get the key for a counter into dst, replacing its contents: see Self::get_counter_key.
Sourcepub fn get_counter_key_str(
&self,
counter_id: i32,
) -> Result<String, AeronCError>
pub fn get_counter_key_str( &self, counter_id: i32, ) -> Result<String, AeronCError>
Get a text key: the bytes up to the first zero, or all of them if there is none. For keys set from a string, not binary keys like a recording id
Sourcepub unsafe fn counter_key_bytes(
&self,
counter_id: i32,
) -> Result<&[u8], AeronCError>
pub unsafe fn counter_key_bytes( &self, counter_id: i32, ) -> Result<&[u8], AeronCError>
Borrow a counter’s key in place, with no copy: all Self::MAX_KEY_LENGTH bytes
§Safety
The slice points into driver memory. If the counter is freed while you hold it, the
driver can reuse the slot and change these bytes. Only use it while the counter stays
allocated, otherwise use Self::get_counter_key
Sourcepub fn get_counter_value(&self, counter_id: i32) -> Result<i64, AeronCError>
pub fn get_counter_value(&self, counter_id: i32) -> Result<i64, AeronCError>
The current value of a counter. An error if counter_id is not a counter id, for
example -1 from a lookup that found nothing
Source§impl AeronCountersReader
impl AeronCountersReader
Sourcepub fn aeron_archive_recording_pos_get_source_identity(
&self,
counter_id: i32,
destination: &mut [u8],
) -> Result<usize, AeronCError>
pub fn aeron_archive_recording_pos_get_source_identity( &self, counter_id: i32, destination: &mut [u8], ) -> Result<usize, AeronCError>
Copies the source identity into destination, including a trailing NUL if nonempty.
Returns the number of bytes copied, excluding that terminator.
Trait Implementations§
Source§impl Clone for AeronCountersReader
impl Clone for AeronCountersReader
Source§fn clone(&self) -> AeronCountersReader
fn clone(&self) -> AeronCountersReader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more