pub struct EmbeddedArchiveMediaDriverProcess {
pub aeron_dir: CString,
pub archive_dir: CString,
pub control_request_channel: String,
pub control_response_channel: String,
pub recording_events_channel: String,
/* private fields */
}Fields§
§aeron_dir: CString§archive_dir: CString§control_request_channel: String§control_response_channel: String§recording_events_channel: StringImplementations§
Source§impl EmbeddedArchiveMediaDriverProcess
impl EmbeddedArchiveMediaDriverProcess
Sourcepub fn build_and_start(
aeron_dir: &str,
archive_dir: &str,
control_request_channel: &str,
control_response_channel: &str,
recording_events_channel: &str,
) -> Result<Self>
pub fn build_and_start( aeron_dir: &str, archive_dir: &str, control_request_channel: &str, control_response_channel: &str, recording_events_channel: &str, ) -> Result<Self>
Builds the Aeron Archive project and starts an embedded Aeron Archive Media Driver process.
This function ensures that the necessary Aeron .jar files are built using Gradle. If the required
.jar files are not found in the expected directory, it runs the Gradle build tasks to generate them.
Once the build is complete, it invokes the start function to initialize and run the Aeron Archive Media Driver.
§Parameters
aeron_dir: The directory for the Aeron media driver to use for its IPC mechanisms.archive_dir: The directory where the Aeron Archive will store its recordings and metadata.control_request_channel: The channel URI used for sending control requests to the Aeron Archive.control_response_channel: The channel URI used for receiving control responses from the Aeron Archive.recording_events_channel: The channel URI used for receiving recording event notifications from the Aeron Archive.
§Returns
On success, returns an instance of EmbeddedArchiveMediaDriverProcess encapsulating the child process
and configuration used. Returns an io::Result if the process fails to start or the build fails.
§Errors
Returns an io::Result::Err if:
- The Gradle build fails to execute or complete.
- The required
.jarfiles are still not found after building. - The
startfunction encounters an error starting the process.
§Example
use rusteron_archive::testing::EmbeddedArchiveMediaDriverProcess;
let driver = EmbeddedArchiveMediaDriverProcess::build_and_start(
"/tmp/aeron-dir",
"/tmp/archive-dir",
"aeron:udp?endpoint=localhost:8010",
"aeron:udp?endpoint=localhost:8011",
"aeron:udp?endpoint=localhost:8012",
).expect("Failed to build and start Aeron Archive Media Driver");§Notes
- This function assumes the presence of a Gradle wrapper script (
gradleworgradlew.bat) in theaerondirectory relative to the project’s root (CARGO_MANIFEST_DIR). - The required
.jarfiles will be generated inaeron/aeron-all/build/libsif not already present. - The
build_and_startfunction is a convenience wrapper for automating the build and initialization process.
pub fn run_aeron_stats(&self) -> Result<Child>
pub fn archive_connect(&self) -> Result<(AeronArchive, Aeron), Error>
Sourcepub fn start(
aeron_dir: &str,
archive_dir: &str,
control_request_channel: &str,
control_response_channel: &str,
recording_events_channel: &str,
) -> Result<Self>
pub fn start( aeron_dir: &str, archive_dir: &str, control_request_channel: &str, control_response_channel: &str, recording_events_channel: &str, ) -> Result<Self>
Starts an embedded Aeron Archive Media Driver process with the specified configurations.
This function cleans and recreates the Aeron and archive directories, configures the JVM to run the Aeron Archive Media Driver, and starts the process with the specified control channels. It ensures that the environment is correctly prepared for Aeron communication.
§Parameters
aeron_dir: The directory for the Aeron media driver to use for its IPC mechanisms.archive_dir: The directory where the Aeron Archive will store its recordings and metadata.control_request_channel: The channel URI used for sending control requests to the Aeron Archive.control_response_channel: The channel URI used for receiving control responses from the Aeron Archive.recording_events_channel: The channel URI used for receiving recording event notifications from the Aeron Archive.
§Returns
On success, returns an instance of EmbeddedArchiveMediaDriverProcess encapsulating the child process
and configuration used. Returns an io::Result if the process fails to start.
§Errors
Returns an io::Result::Err if:
- Cleaning or creating the directories fails.
- The required
.jarfiles are missing or not found. - The Java process fails to start.
§Example
use rusteron_archive::testing::EmbeddedArchiveMediaDriverProcess;
let driver = EmbeddedArchiveMediaDriverProcess::start(
"/tmp/aeron-dir",
"/tmp/archive-dir",
"aeron:udp?endpoint=localhost:8010",
"aeron:udp?endpoint=localhost:8011",
"aeron:udp?endpoint=localhost:8012",
).expect("Failed to start Aeron Archive Media Driver");§Notes
- The Aeron
.jarfiles must be available under the directoryaeron/aeron-all/build/libsrelative to the project’s root (CARGO_MANIFEST_DIR). - The function configures the JVM with properties for Aeron, such as enabling event logging and disabling bounds checks.