Expand description
§rusteron-media-driver
rusteron-media-driver is a module in the rusteron project that provides an interface to the Aeron Media Driver in a Rust environment. This module is crucial for managing the messaging infrastructure between producers and consumers, allowing for efficient low-latency communication.
§Overview
The rusteron-media-driver module is designed to help Rust developers interact with the Aeron Media Driver, which is responsible for managing the communication between different Aeron clients. This module provides a wrapper around the Aeron C Media Driver API and offers both standard and embedded driver options for use in different environments.
The media driver can be used to set up the messaging directory and manage data streams. The embedded media driver is particularly useful for testing purposes or for simplifying deployment scenarios where a separate media driver process is not needed.
§Usage Note
It is recommended to run the media driver using the Aeron Java or C version for production use. This crate primarily serves as a utility to start the media driver embedded within unit or integration tests.
§Installation
To use rusteron-media-driver, add it to your Cargo.toml
:
dynamic lib
[dependencies]
rusteron-media-driver = "0.1"
static lib
[dependencies]
rusteron-media-driver = { version = "0.1", features= ["static"] }
static lib with precompiled c libs (mac os x only)
[dependencies]
rusteron-media-driver = { version = "0.1", features= ["static", "precompile"] }
Ensure that you have also set up the necessary Aeron C libraries required by rusteron-media-driver.
§Features
- Media Driver Management: Start, stop, and configure an Aeron Media Driver instance.
- Embedded Media Driver: Launch an embedded media driver directly from your code for testing purposes.
§Usage Examples
§Standard Media Driver Example
use rusteron_media_driver::{AeronDriver, AeronDriverContext};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let aeron_context = AeronDriverContext::new()?;
aeron_context.set_dir("target/test")?;
// Create Aeron driver
let aeron_driver = AeronDriver::new(&aeron_context)?;
aeron_driver.start(false)?;
println!("Aeron Media Driver started");
Ok(())
}
§Embedded Media Driver Example
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>> {
// Create and launch an embedded media driver
let media_driver_ctx = AeronDriverContext::new()?;
let (stop, driver_handle) = AeronDriver::launch_embedded(media_driver_ctx.clone(), false);
// Create Aeron context and link with the embedded driver
let ctx = AeronContext::new()?;
ctx.set_dir(media_driver_ctx.get_dir())?;
// Wait a bit for demonstration purposes
thread::sleep(Duration::from_secs(3));
// Stop the driver
stop.store(true, Ordering::SeqCst);
driver_handle.join().expect("Failed to join driver thread");
println!("Embedded Aeron Media Driver stopped");
Ok(())
}
§Safety Considerations
Since rusteron-media-driver relies on Aeron C bindings, it involves the use of unsafe
Rust code. Users must ensure:
- Resources are properly managed (e.g., starting and stopping drivers in a correct order).
- Proper synchronisation when accessing shared data in a multithreaded environment.
Improper use of the media driver can lead to crashes or other undefined behaviours.
§Building This Project Instructions
For detailed instructions on how to build rusteron, please refer to the HOW_TO_BUILD.md file.
§Contributing
Contributions are more than welcome! Please see our contributing guidelines for more information on how to get involved.
§License
This project is dual-licensed under either the MIT License or Apache License 2.0. You may choose which one to use.
§Links
Feel free to reach out with any questions or suggestions via GitHub Issues!
§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 AeronCErrorextra-logging
- When enabled will log when resource is created and destroyed. useful if your seeing a segfault due to a resource being closedprecompile
- When enabled will use precompiled c code instead of requiring cmake and java to me installed
Modules§
Structs§
- Addrinfo
- Aeron
- Aeron
Agent Close Func Logger - Aeron
Agent DoWork Func Logger - Aeron
Agent Runner - Aeron
Agent Start Func Logger - Aeron
Async AddCounter - Aeron
Async AddExclusive Publication - Aeron
Async AddPublication - Aeron
Async AddSubscription - Aeron
Async Destination - Aeron
Async Destination ById - Aeron
Atomic Counter - Aeron
Available Counter Logger - Aeron
Available Counter Pair - Aeron
Available Image Logger - Aeron
Block Handler Logger - Aeron
Blocking Linked Queue - Aeron
Broadcast Descriptor - Aeron
Broadcast Record Descriptor - Aeron
Broadcast Transmitter - Aeron
Buffer Claim - Structure used to hold information for a try_claim function call.
- AeronC
Error - Represents an Aeron-specific error with a code and an optional message.
- Aeron
Channel Endpoint Status KeyLayout - Aeron
Client - Aeron
Client Registering Resource - Aeron
Client Timeout - Aeron
Clock Cache - Aeron
Close Client Logger - Aeron
Close Client Pair - Aeron
Cnc - Aeron
CncConstants - Aeron
CncMetadata - Aeron
Congestion Control Strategy - Aeron
Congestion Control Strategy Initial Window Length Func Logger - Aeron
Congestion Control Strategy MaxWindow Length Func Logger - Aeron
Congestion Control Strategy Rttm Func Logger - Aeron
Congestion Control Strategy Rttm Sent Func Logger - Aeron
Congestion Control Strategy Should Measure RttFunc Logger - Aeron
Context - Aeron
Controlled Fragment Assembler - Aeron
Controlled Fragment Handler Logger - Aeron
Correlated Command - Aeron
Counter - Aeron
Counter Command - Aeron
Counter Constants - Configuration for a counter that does not change during it’s lifetime.
- Aeron
Counter Link - Aeron
Counter Metadata Descriptor - Aeron
Counter Update - Aeron
Counter Value Descriptor - Aeron
Counters Manager - Aeron
Counters Reader - Aeron
Counters Reader Buffers - Aeron
Counters Reader Foreach Counter Func Logger - Aeron
Counters Reader Foreach Metadata Func Logger - Aeron
Data Header - Aeron
Data Packet Dispatcher - Aeron
Data Packet Dispatcher Stream Interest - Aeron
Deque - Aeron
Destination ById Command - Aeron
Destination Command - Aeron
Distinct Error Log - Aeron
Distinct Error LogObservation List - Aeron
Distinct Observation - Aeron
DlLoaded Libs State - Aeron
Driver - Aeron
Driver Conductor - Aeron
Driver Conductor Proxy - Aeron
Driver Context - Aeron
Driver Context Bindings Clientd Entry - Aeron
Driver Managed Resource - Aeron
Driver Receiver - Aeron
Driver Receiver Image Entry - Aeron
Driver Receiver Pending Setup Entry - Aeron
Driver Receiver Proxy - Aeron
Driver Sender - Aeron
Driver Sender Network Publication Entry - Aeron
Driver Sender Proxy - Aeron
Driver Termination Hook Func Logger - Aeron
Driver Termination Validator Func Logger - Aeron
Driver UriPublication Params - Aeron
Driver UriSubscription Params - Aeron
Duty Cycle Stall Tracker - Aeron
Duty Cycle Tracker - Aeron
Duty Cycle Tracker Measure AndUpdate Func Logger - Aeron
Duty Cycle Tracker Update Func Logger - Aeron
EndOf Life Resource - Aeron
EndOf Life Resource Free Logger - Aeron
Error - Aeron
Error Handler Logger - Aeron
Error LogEntry - Aeron
Error LogReader Func Logger - Aeron
Error Logger - Aeron
Error Response - Aeron
Exclusive Publication - Aeron
Executor Execution Complete Func Logger - Aeron
Feedback Delay Generator State - Aeron
Flow Control Strategy - Aeron
Flow Control Strategy Error Func Logger - Aeron
Flow Control Strategy Idle Func Logger - Aeron
Flow Control Strategy MaxRetransmission Length Func Logger - Aeron
Flow Control Strategy Setup Func Logger - Aeron
Flow Control Strategy SmFunc Logger - Aeron
Flow Control Strategy Supplier Func Table Entry - Aeron
Flow Control Strategy Trigger Send Setup Func Logger - Aeron
Flow Control Tagged Options - Aeron
Fragment Assembler - Aeron
Fragment Handler Logger - Aeron
Frame Header - Aeron
Header - Aeron
Header Values - Aeron
Header Values Frame - Aeron
Heartbeat Timestamp KeyLayout - Aeron
Idle Strategy - Aeron
Idle Strategy Func Logger - Aeron
Ifaddr Func Logger - Aeron
Image - Aeron
Image Buffers Ready - Aeron
Image Constants - Configuration for an image that does not change during it’s lifetime.
- Aeron
Image Controlled Fragment Assembler - Aeron
Image Fragment Assembler - Aeron
Image Message - Aeron
Int64 Counter Map - Aeron
Int64 Counter MapFor Each Func Logger - Aeron
Int64 Counter MapPredicate Func Logger - Aeron
Int64 ToPtr Hash Map - Aeron
Int64 ToTagged PtrEntry - Aeron
Int64 ToTagged PtrHash Map - Aeron
Iovec - Aeron
IpcChannel Params - Aeron
IpcPublication - Aeron
IpcPublication Entry - Aeron
Linger Resource Entry - Aeron
Linked Queue - Aeron
Linked Queue Node - Aeron
Local Sockaddr KeyLayout - Aeron
LogBuffer - Aeron
Logbuffer Metadata - Aeron
Loss Detector - Aeron
Loss Detector Gap - Aeron
Loss Reporter - Aeron
Loss Reporter Entry - Aeron
Loss Reporter Read Entry Func Logger - Aeron
Mapped Buffer - Aeron
Mapped File - Aeron
Mapped RawLog - Aeron
Mpsc Concurrent Array Queue - Aeron
Mpsc Rb - Aeron
NakHeader - Aeron
Network Publication - Aeron
Network Publication Entry - Aeron
NewPublication Logger - Aeron
NewSubscription Logger - Aeron
Notification Logger - Aeron
Operation Succeeded - Aeron
Option Header - Aeron
Parsed Address - Aeron
Parsed Interface - Aeron
PerThread Error - Aeron
Port Manager - Aeron
Port Manager Free Managed Port Func Logger - Aeron
Port Manager GetManaged Port Func Logger - Aeron
Position - Aeron
Publication - Aeron
Publication Buffers Ready - Aeron
Publication Command - Aeron
Publication Constants - Configuration for a publication that does not change during it’s lifetime.
- Aeron
Publication Error - Aeron
Publication Error Frame Handler Logger - Aeron
Publication Error Values - Aeron
Publication Image - Aeron
Publication Image Connection - Aeron
Publication Image Entry - Aeron
Publication Link - Aeron
RbControlled Handler Logger - Aeron
RbDescriptor - Aeron
RbHandler Logger - Aeron
RbRecord Descriptor - Aeron
Receive Channel Endpoint - Aeron
Receive Channel Endpoint Entry - Aeron
Receive Destination - Aeron
Receive Destination Entry - Aeron
Reject Image Command - Aeron
Remove Command - Aeron
Reserved Value Supplier Logger - Aeron
Resolution Header - Aeron
Resolution Header Ipv4 - Aeron
Resolution Header Ipv6 - Aeron
Response Setup Header - Aeron
Retransmit Action - Aeron
Retransmit Handler - Aeron
Retransmit Handler Resend Func Logger - Aeron
Rttm Header - Aeron
Send Channel Endpoint - Aeron
Send Channel Endpoint Entry - Aeron
Setup Header - Aeron
Spsc Concurrent Array Queue - Aeron
Static Counter Command - Aeron
Static Counter Response - Aeron
Status Message Header - Aeron
Status Message Optional Header - Aeron
StrTo PtrHash Map - Aeron
StrTo PtrHash MapKey - Aeron
Stream Position Counter KeyLayout - Aeron
Subscribable - Aeron
Subscribable List Entry - Aeron
Subscription - Aeron
Subscription Command - Aeron
Subscription Constants - Aeron
Subscription Link - Aeron
Subscription Ready - Aeron
System Counter - Aeron
System Counters - Aeron
Term GapScanner GapDetected Func Logger - Aeron
Terminate Driver Command - Aeron
Tetherable Position - Aeron
UdpChannel - Aeron
UdpChannel Async Parse - Aeron
UdpChannel Data Paths - Aeron
UdpChannel Incoming Interceptor - Aeron
UdpChannel Interceptor Bindings - Aeron
UdpChannel Outgoing Interceptor - Aeron
UdpChannel Params - Aeron
UdpDestination Entry - Aeron
UdpDestination Tracker - Aeron
Unavailable Counter Logger - Aeron
Unavailable Counter Pair - Aeron
Unavailable Image Logger - Aeron
Uri - Aeron
UriHostname Resolver Func Logger - Aeron
UriParam - Aeron
UriParams - Aeron
UriParse Callback Logger - Aeron
UriString Builder - Aeron
Wildcard Port Manager - Atomic
Wide Counter Bindgen Ty1 - Channel
Uri - Represents the Aeron URI parser and handler.
- Handler
- Handler
- Handlers
- Utility method for setting empty handlers
- Ifaddrs
- In6Addr
- Iovec
- ManagedC
Resource - A custom struct for managing C resources with automatic cleanup.
- Mmsghdr
- Msghdr
- Pollfd
- Pthread
CondS - Pthread
Internal List - Pthread
MutexS - Sockaddr
- Sockaddr
Storage - Timespec
Enums§
- Aeron
Error Type - Aeron
System Counter Type - Control
Mode - Enum for control modes.
- Media
- Enum for media types.
Constants§
- AERON_
DIR_ PROP_ NAME - AERON_
IPC_ MEDIA - AERON_
IPC_ STREAM - AERON_
UDP_ MEDIA - DRIVER_
TIMEOUT_ MS_ DEFAULT - SPY_
PREFIX - TAG_
PREFIX
Traits§
- Aeron
Agent Close Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Agent DoWork Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Agent Start Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Available Counter Callback - Function called by aeron_client_t to deliver notifications that a counter has been added to the driver.
- Aeron
Available Image Callback - Function called by aeron_client_t to deliver notifications that an aeron_image_t was added.
- Aeron
Block Handler Callback - Callback for handling a block of messages being read from a log.
- Aeron
Close Client Callback - Function called by aeron_client_t to deliver notifications that the client is closing.
- Aeron
Congestion Control Strategy Initial Window Length Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Congestion Control Strategy MaxWindow Length Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Congestion Control Strategy Rttm Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Congestion Control Strategy Rttm Sent Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Congestion Control Strategy Should Measure RttFunc Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Controlled Fragment Handler Callback - Callback for handling fragments of data being read from a log.
- Aeron
Counters Reader Foreach Counter Func Callback - Function called by aeron_counters_reader_foreach_counter for each counter in the aeron_counters_reader_t.
- Aeron
Counters Reader Foreach Metadata Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Driver Termination Hook Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Driver Termination Validator Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Duty Cycle Tracker Measure AndUpdate Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Duty Cycle Tracker Update Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
EndOf Life Resource Free Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Error Handler Callback - The error handler to be called when an error occurs.
- Aeron
Error LogReader Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Executor Execution Complete Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Flow Control Strategy Error Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Flow Control Strategy Idle Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Flow Control Strategy MaxRetransmission Length Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Flow Control Strategy Setup Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Flow Control Strategy SmFunc Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Flow Control Strategy Trigger Send Setup Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Fragment Handler Callback - Callback for handling fragments of data being read from a log.
- Aeron
Idle Strategy Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Ifaddr Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Int64 Counter MapFor Each Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Int64 Counter MapPredicate Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Loss Reporter Read Entry Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
NewPublication Callback - 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.
- Aeron
NewSubscription Callback - Function called by aeron_client_t to deliver notification that the media driver has added an aeron_subscription_t successfully.
- Aeron
Notification Callback - Generalised notification callback.
- Aeron
Port Manager Free Managed Port Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Port Manager GetManaged Port Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Publication Error Frame Handler Callback - 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. - Aeron
RbControlled Handler Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
RbHandler Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Reserved Value Supplier Callback - Function called when filling in the reserved value field of a message.
- Aeron
Retransmit Handler Resend Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Term GapScanner GapDetected Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Unavailable Counter Callback - Function called by aeron_client_t to deliver notifications that a counter has been removed from the driver.
- Aeron
Unavailable Image Callback - 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.
- Aeron
UriHostname Resolver Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
UriParse Callback Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)