rusteron_archive::testing

Struct EmbeddedArchiveMediaDriverProcess

Source
pub struct EmbeddedArchiveMediaDriverProcess {
    pub aeron_dir: String,
    pub archive_dir: String,
    pub control_request_channel: String,
    pub control_response_channel: String,
    pub recording_events_channel: String,
    /* private fields */
}

Fields§

§aeron_dir: String§archive_dir: String§control_request_channel: String§control_response_channel: String§recording_events_channel: String

Implementations§

Source§

impl EmbeddedArchiveMediaDriverProcess

Source

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 .jar files are still not found after building.
  • The start function 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 (gradlew or gradlew.bat) in the aeron directory relative to the project’s root (CARGO_MANIFEST_DIR).
  • The required .jar files will be generated in aeron/aeron-all/build/libs if not already present.
  • The build_and_start function is a convenience wrapper for automating the build and initialization process.
Source

pub fn run_aeron_stats(&self) -> Result<Child>

Source

pub fn archive_connect(&self) -> Result<(AeronArchive, Aeron), Error>

Source

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 .jar files 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 .jar files must be available under the directory aeron/aeron-all/build/libs relative 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.
Source

pub fn kill_all_java_processes() -> Result<ExitStatus>

Trait Implementations§

Source§

impl Drop for EmbeddedArchiveMediaDriverProcess

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.