1
0
mirror of https://github.com/bspeice/aeron-rs synced 2025-07-01 13:56:07 -04:00

Finally able to terminate a driver.

Need to write a test for it, but it's working locally.
This commit is contained in:
2019-10-06 21:37:38 -04:00
parent 143e21bf0a
commit f4c2fcf0c5
4 changed files with 22 additions and 7 deletions

View File

@ -19,6 +19,9 @@
//! +-----------------------------+
//! ```
use crate::util::bit;
use std::mem::size_of;
/// The CnC file metadata header. Layout:
///
/// ```text
@ -61,6 +64,10 @@ pub struct MetaDataDefinition {
_pid: i64,
}
/// Length of the metadata block in a CnC file. Note that it's not equivalent
/// to the actual struct length.
pub const META_DATA_LENGTH: usize = bit::align_usize(size_of::<MetaDataDefinition>(), bit::CACHE_LINE_LENGTH * 2);
/// Version code for the Aeron CnC file format
pub const CNC_VERSION: i32 = crate::sematic_version_compose(0, 0, 16);

View File

@ -5,9 +5,9 @@ use crate::util::{bit, AeronError, IndexT, Result};
/// Description of the Ring Buffer schema.
pub mod buffer_descriptor {
use crate::client::concurrent::atomic_buffer::AtomicBuffer;
use crate::util::bit::is_power_of_two;
use crate::util::bit::{is_power_of_two, CACHE_LINE_LENGTH};
use crate::util::AeronError::IllegalArgument;
use crate::util::{IndexT, Result, CACHE_LINE_LENGTH};
use crate::util::{IndexT, Result};
// QUESTION: Why are these offsets so large when we only ever use i64 types?

View File

@ -6,9 +6,6 @@
// QUESTION: Can this just be updated to be `usize` in Rust?
pub type IndexT = i32;
/// Length of the data blocks used by the CPU cache sub-system in bytes
pub const CACHE_LINE_LENGTH: usize = 64;
/// Error types from operations in the Aeron client. Synonymous with the exceptions
/// generated by the C++ client.
#[derive(Debug, PartialEq)]
@ -29,6 +26,9 @@ pub mod bit {
use crate::util::IndexT;
use num::PrimInt;
/// Length of the data blocks used by the CPU cache sub-system in bytes
pub const CACHE_LINE_LENGTH: usize = 64;
/// Helper method for quick verification that `IndexT` is a positive power of two
///
/// ```rust
@ -56,4 +56,9 @@ pub mod bit {
{
(val + (alignment - T::one())) & !(alignment - T::one())
}
/// Align a `usize` value. See `align` for similar functionality on general types.
pub const fn align_usize(val: usize, alignment: usize) -> usize {
(val + (alignment - 1)) & !(alignment - 1)
}
}