Crate rusteron_media_driver

Source
Expand description

§rusteron-media-driver

rusteron-media-driver is a Rust interface to the Aeron Media Driver, responsible for managing low-latency messaging infrastructure between producers and consumers. It’s part of the Rusteron project and provides both standalone and embedded driver support.

For production deployments, we recommend using the Aeron Java or C media driver.
The embedded version provided here is best suited for integration tests or lightweight environments.


§Installation

To use rusteron-media-driver, add the appropriate dependency to your Cargo.toml:

Dynamic
[dependencies]
rusteron-media-driver = "0.1"
Static
[dependencies]
rusteron-media-driver = { version = "0.1", features = ["static"] }
Static with precompiled C libs (macOS only)
[dependencies]
rusteron-media-driver = { version = "0.1", features = ["static", "precompile"] }

Ensure the Aeron C libraries are properly installed and available on your system.


§Usage Examples

Standard Media Driver
// Launches a standalone Aeron Media Driver
use rusteron_media_driver::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let aeron_context = AeronDriverContext::new()?;
    aeron_context.set_dir(&"target/test".into_c_string())?;

    let aeron_driver = AeronDriver::new(&aeron_context)?;
    aeron_driver.start(false)?;
    println!("Aeron Media Driver started");

    Ok(())
}
Embedded Media Driver
// Embeds the media driver directly into the current process
use rusteron_media_driver::*;
use std::sync::{Arc, atomic::{AtomicBool, Ordering}};
use std::thread;
use std::time::Duration;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let media_driver_ctx = AeronDriverContext::new()?;
    let (stop, driver_handle) = AeronDriver::launch_embedded(media_driver_ctx.clone(), false);

    let ctx = AeronContext::new()?;
    ctx.set_dir(&media_driver_ctx.get_dir().into_c_string())?;

    thread::sleep(Duration::from_secs(3)); // Simulated workload

    stop.store(true, Ordering::SeqCst);
    driver_handle.join().expect("Failed to join driver thread");
    println!("Embedded Aeron Media Driver stopped");

    Ok(())
}
# Features
  • static: When enabled, this feature statically links the Aeron C code. By default, the library uses dynamic linking to the Aeron C libraries.
  • backtrace - When enabled will log a backtrace for each AeronCError
  • extra-logging - When enabled will log when resource is created and destroyed. useful if your seeing a segfault due to a resource being closed
  • precompile - When enabled will use precompiled c code instead of requiring cmake and java to me installed

Modules§

bindings

Structs§

Addrinfo
Aeron
AeronAgentCloseFuncLogger
AeronAgentDoWorkFuncLogger
AeronAgentRunner
AeronAgentStartFuncLogger
AeronAsyncAddCounter
AeronAsyncAddExclusivePublication
AeronAsyncAddPublication
AeronAsyncAddSubscription
AeronAsyncDestination
AeronAsyncDestinationById
AeronAtomicCounter
AeronAvailableCounterLogger
AeronAvailableCounterPair
AeronAvailableImageLogger
AeronBlockHandlerLogger
AeronBlockingLinkedQueue
AeronBroadcastDescriptor
AeronBroadcastRecordDescriptor
AeronBroadcastTransmitter
AeronBufferClaim
Structure used to hold information for a try_claim function call.
AeronCError
Represents an Aeron-specific error with a code and an optional message.
AeronChannelEndpointStatusKeyLayout
AeronClient
AeronClientRegisteringResource
AeronClientTimeout
AeronClockCache
AeronCloseClientLogger
AeronCloseClientPair
AeronCnc
AeronCncConstants
AeronCncMetadata
AeronCongestionControlStrategy
AeronCongestionControlStrategyInitialWindowLengthFuncLogger
AeronCongestionControlStrategyMaxWindowLengthFuncLogger
AeronCongestionControlStrategyRttmFuncLogger
AeronCongestionControlStrategyRttmSentFuncLogger
AeronCongestionControlStrategyShouldMeasureRttFuncLogger
AeronContext
AeronControlledFragmentAssembler
AeronControlledFragmentClosureAssembler
AeronControlledFragmentHandlerLogger
AeronCorrelatedCommand
AeronCounter
AeronCounterCommand
AeronCounterConstants
Configuration for a counter that does not change during it’s lifetime.
AeronCounterLink
AeronCounterMetadataDescriptor
AeronCounterUpdate
AeronCounterValueDescriptor
AeronCountersManager
AeronCountersReader
AeronCountersReaderBuffers
AeronCountersReaderForeachCounterFuncLogger
AeronCountersReaderForeachMetadataFuncLogger
AeronDataHeader
AeronDataHeaderAsLongs
AeronDataPacketDispatcher
AeronDataPacketDispatcherStreamInterest
AeronDeque
AeronDestinationByIdCommand
AeronDestinationCommand
AeronDistinctErrorLog
AeronDistinctErrorLogObservationList
AeronDistinctObservation
AeronDlLoadedLibsState
AeronDriver
AeronDriverConductor
AeronDriverConductorProxy
AeronDriverContext
AeronDriverContextBindingsClientdEntry
AeronDriverManagedResource
AeronDriverReceiver
AeronDriverReceiverImageEntry
AeronDriverReceiverPendingSetupEntry
AeronDriverReceiverProxy
AeronDriverSender
AeronDriverSenderNetworkPublicationEntry
AeronDriverSenderProxy
AeronDriverTerminationHookFuncLogger
AeronDriverTerminationValidatorFuncLogger
AeronDriverUriPublicationParams
AeronDriverUriSubscriptionParams
AeronDutyCycleStallTracker
AeronDutyCycleTracker
AeronDutyCycleTrackerMeasureAndUpdateFuncLogger
AeronDutyCycleTrackerUpdateFuncLogger
AeronEndOfLifeResource
AeronEndOfLifeResourceFreeLogger
AeronError
AeronErrorHandlerLogger
AeronErrorLogEntry
AeronErrorLogReaderFuncLogger
AeronErrorLogger
AeronErrorResponse
AeronExclusivePublication
AeronExecutorExecutionCompleteFuncLogger
AeronFeedbackDelayGeneratorState
AeronFlowControlMaxOptions
AeronFlowControlStrategy
AeronFlowControlStrategyErrorFuncLogger
AeronFlowControlStrategyIdleFuncLogger
AeronFlowControlStrategyMaxRetransmissionLengthFuncLogger
AeronFlowControlStrategySetupFuncLogger
AeronFlowControlStrategySmFuncLogger
AeronFlowControlStrategySupplierFuncTableEntry
AeronFlowControlStrategyTriggerSendSetupFuncLogger
AeronFlowControlTaggedOptions
AeronFragmentAssembler
AeronFragmentClosureAssembler
AeronFragmentHandlerLogger
AeronFrameHeader
AeronHeader
AeronHeaderValues
AeronHeaderValuesFrame
AeronHeartbeatTimestampKeyLayout
AeronIdleStrategy
AeronIdleStrategyFuncLogger
AeronIfaddrFuncLogger
AeronImage
AeronImageBuffersReady
AeronImageConstants
Configuration for an image that does not change during it’s lifetime.
AeronImageControlledFragmentAssembler
AeronImageFragmentAssembler
AeronImageMessage
AeronInt64CounterMap
AeronInt64CounterMapForEachFuncLogger
AeronInt64CounterMapPredicateFuncLogger
AeronInt64ToPtrHashMap
AeronInt64ToTaggedPtrEntry
AeronInt64ToTaggedPtrHashMap
AeronIovec
AeronIpcChannelParams
AeronIpcPublication
AeronIpcPublicationEntry
AeronLingerResourceEntry
AeronLinkedQueue
AeronLinkedQueueNode
AeronLocalSockaddrKeyLayout
AeronLogBuffer
AeronLogbufferMetadata
AeronLossDetector
AeronLossDetectorGap
AeronLossReporter
AeronLossReporterEntry
AeronLossReporterReadEntryFuncLogger
AeronMappedBuffer
AeronMappedFile
AeronMappedRawLog
AeronMpscConcurrentArrayQueue
AeronMpscRb
AeronNakHeader
AeronNetworkPublication
AeronNetworkPublicationEntry
AeronNewPublicationLogger
AeronNewSubscriptionLogger
AeronNotificationLogger
AeronOperationSucceeded
AeronOptionHeader
AeronParsedAddress
AeronParsedInterface
AeronPerThreadError
AeronPortManager
AeronPortManagerFreeManagedPortFuncLogger
AeronPortManagerGetManagedPortFuncLogger
AeronPosition
AeronPublication
AeronPublicationBuffersReady
AeronPublicationCommand
AeronPublicationConstants
Configuration for a publication that does not change during it’s lifetime.
AeronPublicationError
AeronPublicationErrorFrameHandlerLogger
AeronPublicationErrorValues
AeronPublicationImage
AeronPublicationImageConnection
AeronPublicationImageEntry
AeronPublicationLink
AeronRbControlledHandlerLogger
AeronRbDescriptor
AeronRbHandlerLogger
AeronRbRecordDescriptor
AeronReceiveChannelEndpoint
AeronReceiveChannelEndpointEntry
AeronReceiveDestination
AeronReceiveDestinationEntry
AeronRejectImageCommand
AeronRemoveCounterCommand
AeronRemovePublicationCommand
AeronRemoveSubscriptionCommand
AeronReservedValueSupplierLogger
AeronResolutionHeader
AeronResolutionHeaderIpv4
AeronResolutionHeaderIpv6
AeronResponseSetupHeader
AeronRetransmitAction
AeronRetransmitHandler
AeronRetransmitHandlerResendFuncLogger
AeronRttmHeader
AeronSendChannelEndpoint
AeronSendChannelEndpointEntry
AeronSetupHeader
AeronSpscConcurrentArrayQueue
AeronStaticCounterCommand
AeronStaticCounterResponse
AeronStatusMessageHeader
AeronStatusMessageOptionalHeader
AeronStrToPtrHashMap
AeronStrToPtrHashMapKey
AeronStreamPositionCounterKeyLayout
AeronSubscribable
AeronSubscribableListEntry
AeronSubscription
AeronSubscriptionCommand
AeronSubscriptionConstants
AeronSubscriptionLink
AeronSubscriptionReady
AeronSystemCounter
AeronSystemCounters
AeronTermGapScannerGapDetectedFuncLogger
AeronTerminateDriverCommand
AeronTetherablePosition
AeronUdpChannel
AeronUdpChannelAsyncParse
AeronUdpChannelDataPaths
AeronUdpChannelIncomingInterceptor
AeronUdpChannelInterceptorBindings
AeronUdpChannelOutgoingInterceptor
AeronUdpChannelParams
AeronUdpDestinationEntry
AeronUdpDestinationTracker
AeronUnavailableCounterLogger
AeronUnavailableCounterPair
AeronUnavailableImageLogger
AeronUri
AeronUriHostnameResolverFuncLogger
AeronUriParam
AeronUriParams
AeronUriParseCallbackLogger
AeronUriStringBuilder
AeronWildcardPortManager
ChannelUri
Represents the Aeron URI parser and handler.
DarwinPthreadHandlerRec
FnMutControlledMessageHandler
FnMutMessageHandler
Handler
Handler
Handlers
Utility method for setting empty handlers
Ifaddrs
In6Addr
Iovec
ManagedCResource
A custom struct for managing C resources with automatic cleanup.
Mmsghdr
Msghdr
OpaquePthread
OpaquePthreadAttr
OpaquePthreadCond
OpaquePthreadMutex
Pollfd
Sockaddr
SockaddrStorage
Timespec

Enums§

AeronErrorType
AeronSystemCounterType
CResource
ControlMode
Enum for control modes.
Media
Enum for media types.

Constants§

AERON_DIR_PROP_NAME
AERON_IPC_MEDIA
AERON_UDP_MEDIA
DRIVER_TIMEOUT_MS_DEFAULT
SPY_PREFIX
TAG_PREFIX

Statics§

AERON_IPC_STREAM

Traits§

AeronAgentCloseFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronAgentDoWorkFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronAgentStartFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronAvailableCounterCallback
Function called by aeron_client_t to deliver notifications that a counter has been added to the driver.
AeronAvailableImageCallback
Function called by aeron_client_t to deliver notifications that an aeron_image_t was added.
AeronBlockHandlerCallback
Callback for handling a block of messages being read from a log.
AeronCloseClientCallback
Function called by aeron_client_t to deliver notifications that the client is closing.
AeronCongestionControlStrategyInitialWindowLengthFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronCongestionControlStrategyMaxWindowLengthFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronCongestionControlStrategyRttmFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronCongestionControlStrategyRttmSentFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronCongestionControlStrategyShouldMeasureRttFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronControlledFragmentHandlerCallback
Callback for handling fragments of data being read from a log.
AeronCountersReaderForeachCounterFuncCallback
Function called by aeron_counters_reader_foreach_counter for each counter in the aeron_counters_reader_t.
AeronCountersReaderForeachMetadataFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronDriverTerminationHookFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronDriverTerminationValidatorFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronDutyCycleTrackerMeasureAndUpdateFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronDutyCycleTrackerUpdateFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronEndOfLifeResourceFreeCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronErrorHandlerCallback
The error handler to be called when an error occurs.
AeronErrorLogReaderFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronExecutorExecutionCompleteFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronFlowControlStrategyErrorFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronFlowControlStrategyIdleFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronFlowControlStrategyMaxRetransmissionLengthFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronFlowControlStrategySetupFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronFlowControlStrategySmFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronFlowControlStrategyTriggerSendSetupFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronFragmentHandlerCallback
Callback for handling fragments of data being read from a log.
AeronIdleStrategyFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronIfaddrFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronInt64CounterMapForEachFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronInt64CounterMapPredicateFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronLossReporterReadEntryFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronNewPublicationCallback
Function called by aeron_client_t to deliver notification that the media driver has added an aeron_publication_t or aeron_exclusive_publication_t successfully.
AeronNewSubscriptionCallback
Function called by aeron_client_t to deliver notification that the media driver has added an aeron_subscription_t successfully.
AeronNotificationCallback
Generalised notification callback.
AeronPortManagerFreeManagedPortFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronPortManagerGetManagedPortFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronPublicationErrorFrameHandlerCallback
The error frame handler to be called when the driver notifies the client about an error frame being received. The data passed to this callback will only be valid for the lifetime of the callback. The user should use aeron_publication_error_values_copy if they require the data to live longer than that.
AeronRbControlledHandlerCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronRbHandlerCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronReservedValueSupplierCallback
Function called when filling in the reserved value field of a message.
AeronRetransmitHandlerResendFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronTermGapScannerGapDetectedFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronUnavailableCounterCallback
Function called by aeron_client_t to deliver notifications that a counter has been removed from the driver.
AeronUnavailableImageCallback
Function called by aeron_client_t to deliver notifications that an aeron_image_t has been removed from use and should not be used any longer.
AeronUriHostnameResolverFuncCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
AeronUriParseCallbackCallback
(note you must copy any arguments that you use afterwards even those with static lifetimes)
IntoCString

Functions§

find_unused_udp_port
is_udp_port_available