pub struct Ref<'a, T> { /* private fields */ }Expand description
A wrapper around a C object that belongs to the value it came from, such as the
context returned by archive.get_archive_context()
The lifetime ties it to that owner, so dropping or closing the owner while a Ref
is alive does not compile. Use it through Deref like the wrapper itself
The owner is tracked with PhantomData rather than an Rc/Arc clone for
performance: getters such as archive.aeron() are called on the hot path (for
example in do_work), and a reference count would add an increment and decrement
(atomic under multi-threaded) on every call. Ref holds only the C pointer, so
the borrow checker enforces the lifetime at zero runtime cost
ref.clone() keeps the lifetime. Cloning the inner wrapper (T::clone(&*r)) does
not, and that copy must not outlive the owner
Implementations§
Source§impl<'a> Ref<'a, AeronArchiveContext>
impl<'a> Ref<'a, AeronArchiveContext>
Source§impl<'a> Ref<'a, AeronArchiveControlResponsePoller>
impl<'a> Ref<'a, AeronArchiveControlResponsePoller>
pub fn subscription(&self) -> Ref<'a, AeronSubscription>
pub fn fragment_assembler(&self) -> Ref<'a, AeronControlledFragmentAssembler>
Source§impl<'a> Ref<'a, AeronArchiveCredentialsSupplier>
impl<'a> Ref<'a, AeronArchiveCredentialsSupplier>
pub fn encoded_credentials(&self) -> Ref<'a, AeronArchiveEncodedCredentials>
Source§impl<'a> Ref<'a, AeronArchivePersistentSubscriptionContext>
impl<'a> Ref<'a, AeronArchivePersistentSubscriptionContext>
Sourcepub fn get_state_counter(&self) -> Ref<'a, AeronCounter>
pub fn get_state_counter(&self) -> Ref<'a, AeronCounter>
Get the counter for tracking the current state of the persistent subscription.
§Return
the state counter. @see aeron_archive_persistent_subscription_context_set_state_counter
Sourcepub fn get_join_difference_counter(&self) -> Ref<'a, AeronCounter>
pub fn get_join_difference_counter(&self) -> Ref<'a, AeronCounter>
Get the counter for tracking the join difference of the persistent subscription.
§Return
the join difference counter. @see aeron_archive_persistent_subscription_context_set_join_difference_counter
Sourcepub fn get_live_left_counter(&self) -> Ref<'a, AeronCounter>
pub fn get_live_left_counter(&self) -> Ref<'a, AeronCounter>
Get the counter for tracking the number of times the live stream has been left.
§Return
the live left counter. @see aeron_archive_persistent_subscription_context_set_live_left_counter
Sourcepub fn get_live_joined_counter(&self) -> Ref<'a, AeronCounter>
pub fn get_live_joined_counter(&self) -> Ref<'a, AeronCounter>
Get the counter for tracking the number of times live has been joined.
§Return
the live joined counter. @see aeron_archive_persistent_subscription_context_set_live_joined_counter
Source§impl<'a> Ref<'a, AeronArchiveProxy>
impl<'a> Ref<'a, AeronArchiveProxy>
pub fn ctx(&self) -> Ref<'a, AeronArchiveContext>
pub fn exclusive_publication(&self) -> Ref<'a, AeronExclusivePublication>
Source§impl<'a> Ref<'a, AeronArchiveRecordingDescriptorPoller>
impl<'a> Ref<'a, AeronArchiveRecordingDescriptorPoller>
pub fn ctx(&self) -> Ref<'a, AeronArchiveContext>
pub fn subscription(&self) -> Ref<'a, AeronSubscription>
pub fn fragment_assembler(&self) -> Ref<'a, AeronControlledFragmentAssembler>
Source§impl<'a> Ref<'a, AeronArchiveRecordingSubscriptionDescriptorPoller>
impl<'a> Ref<'a, AeronArchiveRecordingSubscriptionDescriptorPoller>
pub fn ctx(&self) -> Ref<'a, AeronArchiveContext>
pub fn subscription(&self) -> Ref<'a, AeronSubscription>
pub fn fragment_assembler(&self) -> Ref<'a, AeronControlledFragmentAssembler>
Source§impl<'a> Ref<'a, AeronArchiveReplayMerge>
impl<'a> Ref<'a, AeronArchiveReplayMerge>
Sourcepub fn image(&self) -> Ref<'a, AeronImage>
pub fn image(&self) -> Ref<'a, AeronImage>
Source§impl<'a> Ref<'a, AeronArchiveReplicationParams>
impl<'a> Ref<'a, AeronArchiveReplicationParams>
pub fn encoded_credentials(&self) -> Ref<'a, AeronArchiveEncodedCredentials>
Source§impl<'a> Ref<'a, AeronArchive>
impl<'a> Ref<'a, AeronArchive>
Sourcepub fn get_archive_context(&self) -> Ref<'a, AeronArchiveContext>
pub fn get_archive_context(&self) -> Ref<'a, AeronArchiveContext>
Retrieve the underlying AeronArchiveContext used to configure the provided AeronArchive.
Sourcepub fn get_and_own_archive_context(&self) -> Ref<'a, AeronArchiveContext>
pub fn get_and_own_archive_context(&self) -> Ref<'a, AeronArchiveContext>
Retrieve the underlying AeronArchiveContext used to configure the provided AeronArchive.
Additionally, calling this function transfers ownership of the returned AeronArchiveContext to the caller.
i.e. it is now the caller’s responsibility to close the context.
This is useful when wrapping the C library in other, higher level languages.
Sourcepub fn get_control_response_subscription(&self) -> Ref<'a, AeronSubscription>
pub fn get_control_response_subscription(&self) -> Ref<'a, AeronSubscription>
Retrieve the underlying AeronSubscription used for reading responses from the connected Aeron Archive.
Sourcepub fn get_and_own_control_response_subscription(
&self,
) -> Ref<'a, AeronSubscription>
pub fn get_and_own_control_response_subscription( &self, ) -> Ref<'a, AeronSubscription>
Retrieve the underlying AeronSubscription used for reading responses from the connected Aeron Archive.
Additionally, calling this function transfers ownership of the returned AeronSubscription to the caller.
i.e. it is now the caller’s responsibility to close the subscription.
This is useful when wrapping the C library in other, high level languages.
pub fn control_response_poller( &self, ) -> Ref<'a, AeronArchiveControlResponsePoller>
pub fn proxy(&self) -> Ref<'a, AeronArchiveProxy>
pub fn ctx(&self) -> Ref<'a, AeronArchiveContext>
pub fn archive_proxy(&self) -> Ref<'a, AeronArchiveProxy>
pub fn subscription(&self) -> Ref<'a, AeronSubscription>
pub fn recording_descriptor_poller( &self, ) -> Ref<'a, AeronArchiveRecordingDescriptorPoller>
pub fn recording_subscription_descriptor_poller( &self, ) -> Ref<'a, AeronArchiveRecordingSubscriptionDescriptorPoller>
Source§impl<'a> Ref<'a, AeronCnc>
impl<'a> Ref<'a, AeronCnc>
Sourcepub fn counters_reader(&self) -> Ref<'a, AeronCountersReader>
pub fn counters_reader(&self) -> Ref<'a, AeronCountersReader>
Gets a counters reader for this command and control file. This does not need to be closed manually, resources are tied to the instance of aeron_cnc.
§Return
pointer to a counters reader.
Source§impl<'a> Ref<'a, AeronImageConstants>
impl<'a> Ref<'a, AeronImageConstants>
pub fn subscription(&self) -> Ref<'a, AeronSubscription>
Source§impl<'a> Ref<'a, AeronStrToPtrHashMap>
impl<'a> Ref<'a, AeronStrToPtrHashMap>
pub fn keys(&self) -> Ref<'a, AeronStrToPtrHashMapKey>
Source§impl<'a> Ref<'a, Aeron>
impl<'a> Ref<'a, Aeron>
Sourcepub fn context(&self) -> Ref<'a, AeronContext>
pub fn context(&self) -> Ref<'a, 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 counters_reader(&self) -> Ref<'a, AeronCountersReader>
pub fn counters_reader(&self) -> Ref<'a, 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.