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.
§Sponsored by GSR
Rusteron is proudly sponsored and maintained by GSR, a global leader in algorithmic trading and market making in digital assets.
It powers mission-critical infrastructure in GSR’s real-time trading stack and is now developed under the official GSR GitHub organization as part of our commitment to open-source excellence and community collaboration.
We welcome contributions, feedback, and discussions. If you’re interested in integrating or contributing, please open an issue or reach out directly.
§Installation
To use rusteron-media-driver, add the appropriate dependency to your Cargo.toml:
Dynamic
[dependencies]
rusteron-media-driver = "0.2"Static
[dependencies]
rusteron-media-driver = { version = "0.2", features = ["static"] }Static with precompiled C libs (macOS only)
[dependencies]
rusteron-media-driver = { version = "0.2", features = ["static", "precompile"] }[dependencies]
rusteron-media-driver = { version = "0.2", features = ["static", "precompile-rustls"] }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(c"target/test")?;
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(&cformat!("{}", media_driver_ctx.get_dir()))?;
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(())
}§Contributing & License
See the root README and CONTRIBUTING.md. Build requirements are in BUILD.md. Dual-licensed under MIT or Apache-2.0.
§Acknowledgments
Special thanks to:
- @mimran1980, a core low-latency developer at GSR and the original creator of Rusteron - your work made this possible!
- @bspeice for the original
libaeron-sys - The Aeron community for open protocol excellence
§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 you’re seeing a segfault due to a resource being closedlog-c-bindings: When enabled will log every C binding call with arguments and return values. Useful for debugging FFI interactionsprecompile: When enabled will use precompiled C code instead of requiring cmake and java to be installed
Modules§
Macros§
- cformat
format!for C strings: builds the formattedStringand converts it to aCStringin one visibly-named step.
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
Async GetNext Available Session Id - Aeron
Atomic Counter - Aeron
Available Counter Logger - Aeron
Available Counter Pair - Aeron
Available Image Logger - Aeron
Block Handler Logger - 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 - Aeron C API error: code + optional message.
- Aeron
Channel Endpoint Status KeyLayout - Aeron
Claim - Zero-copy claim on a publication’s term buffer with a RAII commit-or-abort lifecycle.
- 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 Closure 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 its 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 Header AsLongs - 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 Client Command - Aeron
Driver Conductor Driver Command - Aeron
Driver Conductor Proxy - Aeron
Driver Context - Aeron
Driver Context Bindings Clientd Entry - Aeron
Driver Managed Resource - Aeron
Driver Native Resource Agent - Aeron
Driver Native Resource Agent Command Result - Aeron
Driver Native Resource Agent Proxy - Aeron
Driver Native Resource Agent Proxy Cmd - Aeron
Driver Native Resource Agent Proxy CmdFree LogBuffer - Aeron
Driver Native Resource Agent Proxy CmdMap LogBuffer - Aeron
Driver Native Resource Agent Proxy CmdParse Channel - Aeron
Driver Native Resource Agent Proxy CmdResolve Address - 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 - Production error handler that routes Aeron async errors through the Rust
logfacade at error level with a concise format — the recommended default forAeronContext::set_error_handler. - Aeron
Error Response - Aeron
Exclusive Publication - Aeron
Feedback Delay Generator State - Aeron
Flow Control MaxOptions - 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
Fprintf Handler Logger - Aeron
Fragment Assembler - Aeron
Fragment Closure Assembler - Aeron
Fragment Handler Logger - Aeron
Frame Header - Aeron
GetNext Available Session IdCommand - 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 ToPtr Hash MapFor Each Func Logger - Aeron
Int64 ToPtr Hash MapPredicate Func Logger - Aeron
Int64 ToTagged PtrEntry - Aeron
Int64 ToTagged PtrHash Map - Aeron
Int64 ToTagged PtrHash MapFor Each Func Logger - Aeron
Int64 ToTagged PtrHash MapPredicate Func Logger - Aeron
Iovec - Aeron
IpcChannel Params - Aeron
IpcPublication - Aeron
IpcPublication Entry - Aeron
Linger Resource Entry - Aeron
Local Sockaddr KeyLayout - Aeron
LogBuffer - Aeron
Logbuffer Metadata - Aeron
Loss Detector - Aeron
Loss Detector Gap - Aeron
Loss Generator - Aeron
Loss Generator Should Drop Frame Detailed Func Logger - Aeron
Loss Generator Should Drop Frame Simple Func Logger - 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 Rb - Aeron
NakHeader - Aeron
Named Interface - Aeron
Network Publication - Aeron
Network Publication Entry - Aeron
NewPublication Logger - Aeron
NewSubscription Logger - Aeron
Next Available Session IdResponse - 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
Queue Drain Func Logger - Aeron
RbControlled Handler Logger - Aeron
RbDescriptor - Aeron
RbHandler Logger - Aeron
RbRecord Descriptor - Aeron
Receive Channel Endpoint - Aeron
Receive Channel Endpoint Entry - Aeron
Receive Channel Loss Supplier Func Logger - Aeron
Receive Destination - Aeron
Receive Destination Entry - Aeron
Reject Image Command - Aeron
Remove Counter Command - Aeron
Remove Publication Command - Aeron
Remove Subscription 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
Send Channel Loss Supplier Func Logger - Aeron
Setup Header - Aeron
Spsc Concurrent Array Queue - Aeron
Spsc Rb - Aeron
Static Counter Command - Aeron
Static Counter Response - Aeron
Status Message Header - Aeron
Status Message Optional Header - Aeron
Status Tracker - Status transition tracker that emits only when the observed
AeronStatusdiffers from the previously recorded state. - Aeron
StrTo PtrHash Map - Aeron
StrTo PtrHash MapFor Each Func Logger - 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 - Channel
Uri - Represents the Aeron URI parser and handler.
- Embedded
Media Driver - RAII guard for an embedded media driver launched via
AeronDriver::launch_embedded_guard. Signals stop on drop so the driver thread always joins even on panic / early return. - FnMut
Controlled Message Handler - FnMut
Message Handler - Handler
- Handler
- Handlers
- Utility method for setting empty handlers
- Ifaddrs
- In6Addr
- InAddr
- Iovec
- ManagedC
Resource - A custom struct for managing C resources with automatic cleanup.
- Mmsghdr
- Msghdr
- NoHandler
- Type-level “no callback” sentinel.
- Pollfd
- Sockaddr
- Sockaddr
Storage - Timespec
Enums§
- Aeron
Error Type - Aeron
Idle Strategy Kind - Aeron’s named idle strategies, as accepted by the context / media-driver
set_*_idle_strategyoptions (the Caeron_idle_strategy_loadsymbol table). - Aeron
Offer Error - Typed error for
offer/try_claimon a publication. - Aeron
Status - High-level connection state of a publication or subscription.
- Aeron
System Counter Type - CResource
- Control
Mode - Enum for control modes.
- Media
- Enum for media types.
Constants§
- AERON_
DIR_ PROP_ NAME - AERON_
IPC_ MEDIA - AERON_
UDP_ MEDIA - DRIVER_
TIMEOUT_ MS_ DEFAULT - MAX_
OFFER_ PARTS - Max buffer parts accepted by
AeronPublication::offer_parts/AeronExclusivePublication::offer_parts— theaeron_iovec_tarray is built on the stack, so it has a fixed capacity. Use the rawoffervwith your own iovec array for larger gathers. - SPY_
PREFIX - TAG_
PREFIX
Statics§
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
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
Fprintf Handler 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
Int64 ToPtr Hash MapFor Each Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Int64 ToPtr Hash MapPredicate Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Int64 ToTagged PtrHash MapFor Each Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Int64 ToTagged PtrHash MapPredicate Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Loss Generator Should Drop Frame Detailed Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
Loss Generator Should Drop Frame Simple 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_copyif they require the data to live longer than that. - Aeron
Queue Drain Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- 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
Receive Channel Loss Supplier Func 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
Send Channel Loss Supplier Func Callback - (note you must copy any arguments that you use afterwards even those with static lifetimes)
- Aeron
StrTo PtrHash MapFor Each 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)
- Controlled
Fragment Assemblable - A poll target whose raw fragments can be reassembled by
AeronControlledFragmentAssembler. - Fragment
Assemblable - A poll target whose raw fragments can be reassembled by
AeronFragmentAssembler. Implemented forAeronSubscriptionhere and for archive types in rusteron-archive. - IntoC
String
Functions§
- find_
unused_ udp_ port - is_
udp_ port_ available - validate_
endpoint_ for_ aeron_ udp - Validate a UDP channel URI endpoint (host:port) for use with Aeron.
Type Aliases§
- Cleanup
Box - RcOrArc
- Reference-counting smart pointer:
Rcby default,Arcunder themulti-threadedfeature. Swap is transparent —RcOrArc::new,.clone(),strong_countall work on both. - RefCell
OrMutex