Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ library), **rsdm** (a PyDM-style EPICS display layer built on rsplot), and

## [Unreleased]

### Changed

- **Bumped the EPICS backends `epics-ca-rs` / `epics-base-rs` / `epics-pva-rs`
to 0.34.0** (from 0.24.x), affecting `rsdm`'s `ca`/`pva`/`calc` features
only. Two API changes were adapted:
- The CA `DBR_CTRL` metadata read takes its bound as an argument; `rsdm`
passes the 30 s that 0.24 applied internally.
- Array payloads are shared buffers (`SharedArray` in `EpicsValue`, `PvArray`
in the pvAccess types) instead of `Vec`; `rsdm`'s CA writes hand its
`Arc<[T]>` buffers over with `into()` instead of copying them.
- **`rsdm` MSRV 1.95 → 1.98.** `epics-base-rs` 0.34.0 calls
`isolate_lowest_one` (stable in 1.97), so 1.96 cannot build it; 1.98.0 is
the oldest toolchain checked. `rsplot` and `adl2rsdm` stay at 1.95.

## [0.6.1] - 2026-10-18

### Fixed
Expand Down
14 changes: 7 additions & 7 deletions rsdm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "rsdm"
version = "0.6.1"
edition = "2024"
rust-version = "1.95"
rust-version = "1.98"
license = "MIT OR Apache-2.0"
description = "PyDM-style EPICS display widgets and data engine, built on rsplot"
repository = "https://github.com/physwkim/rsplot"
Expand Down Expand Up @@ -79,20 +79,20 @@ image = { version = "0.25", default-features = false, features = [
"tiff",
] }

# EPICS Channel Access backend (feature `ca`). crates.io 0.24.x — an explicit
# EPICS Channel Access backend (feature `ca`). crates.io 0.34.x — an explicit
# deviation from rsplot's no-new-dependency rule, scoped to this crate.
epics-ca-rs = { version = "0.24", optional = true }
epics-ca-rs = { version = "0.34", optional = true }
# `Snapshot`/`AlarmInfo`/`DisplayInfo`/`ControlInfo`/`EnumInfo`/`DbrClass`/
# `EpicsValue` returned by the CA client live here and are not re-exported by
# epics-ca-rs, so this is a direct dependency. Unified to the same 0.24.x that
# epics-ca-rs, so this is a direct dependency. Unified to the same 0.34.x that
# epics-ca-rs pins, so there is one copy in the tree.
epics-base-rs = { version = "0.24", optional = true }
# pvAccess backend (feature `pva`). crates.io 0.24.x, same explicit deviation
epics-base-rs = { version = "0.34", optional = true }
# pvAccess backend (feature `pva`). crates.io 0.34.x, same explicit deviation
# from rsplot's no-new-dependency rule, scoped to this crate. The NT
# value/structure types (`PvField`/`PvStructure`/`ScalarValue`/`NTScalar`) are
# re-exported by this crate, so no extra epics-base-rs surface is pulled in for
# `pva` alone.
epics-pva-rs = { version = "0.24", optional = true }
epics-pva-rs = { version = "0.34", optional = true }
# NTNDArray codec decompression (feature `pva`, `pva_codec.rs`): raw-LZ4-block
# and blosc/bitshuffle LZ4 sub-streams decode with lz4_flex — the same pure-Rust
# block codec rust-hdf5's `lz4` feature uses (rust-hdf5's public filter API
Expand Down
39 changes: 26 additions & 13 deletions rsdm/src/data_plugins/epics_plugins/ca_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ use crate::channel::{AlarmSeverity, ChannelState, PvValue, StateWriter};
use crate::data_plugins::{ConnectionCtx, DataPlugin};
use crate::engine::EngineError;

/// Bound on a `DBR_CTRL` metadata read: the 30 s that epics-ca-rs 0.24 applied
/// inside `get_with_metadata` before the bound became the caller's argument.
const CTRL_READ_TIMEOUT: Duration = Duration::from_secs(30);

/// The `ca://` data plugin. Holds the lazily-initialized, engine-shared
/// [`CaClient`] (PyDM's process-wide pyepics context).
pub struct CaPlugin {
Expand Down Expand Up @@ -361,7 +365,10 @@ async fn on_connect(
let write = info.access_rights.write && !read_only;
writer.update(move |s| s.write_access = write);
}
match ch.get_with_metadata(DbrClass::Ctrl).await {
match ch
.get_with_metadata(DbrClass::Ctrl, CTRL_READ_TIMEOUT)
.await
{
Ok(snap) => {
let strings: Option<Arc<[String]>> = snap
.enums
Expand Down Expand Up @@ -415,7 +422,10 @@ async fn on_property_change(
enum_cache: &mut Option<Arc<[String]>>,
) {
// On a transient read failure the current metadata is simply kept.
if let Ok(snap) = ch.get_with_metadata(DbrClass::Ctrl).await {
if let Ok(snap) = ch
.get_with_metadata(DbrClass::Ctrl, CTRL_READ_TIMEOUT)
.await
{
let strings: Option<Arc<[String]>> = snap
.enums
.as_ref()
Expand Down Expand Up @@ -592,12 +602,12 @@ fn pv_to_epics(
) -> Option<EpicsValue> {
match value {
// Waveforms keep their element type; the IOC coerces to the native FTVL.
PvValue::FloatArray(a) => Some(EpicsValue::DoubleArray(a.to_vec())),
PvValue::IntArray(a) => Some(EpicsValue::Int64Array(a.to_vec())),
PvValue::FloatArray(a) => Some(EpicsValue::DoubleArray(Arc::clone(a).into())),
PvValue::IntArray(a) => Some(EpicsValue::Int64Array(Arc::clone(a).into())),
PvValue::StrArray(a) => Some(EpicsValue::StringArray(
a.iter().map(PvString::from).collect(),
)),
PvValue::Bytes(a) => Some(EpicsValue::CharArray(a.to_vec())),
PvValue::Bytes(a) => Some(EpicsValue::CharArray(Arc::clone(a).into())),
scalar => scalar_to_native(scalar, native, enum_strings),
}
}
Expand Down Expand Up @@ -752,24 +762,27 @@ mod tests {
#[test]
fn arrays_map_to_typed_waveforms() {
assert_eq!(
epics_to_pv(&EpicsValue::DoubleArray(vec![1.0, 2.0]), None),
epics_to_pv(&EpicsValue::DoubleArray(vec![1.0, 2.0].into()), None),
PvValue::FloatArray(Arc::from([1.0_f64, 2.0].as_slice()))
);
assert_eq!(
epics_to_pv(&EpicsValue::LongArray(vec![3, 4]), None),
epics_to_pv(&EpicsValue::LongArray(vec![3, 4].into()), None),
PvValue::IntArray(Arc::from([3_i64, 4].as_slice()))
);
assert_eq!(
epics_to_pv(&EpicsValue::FloatArray(vec![1.5_f32]), None),
epics_to_pv(&EpicsValue::FloatArray(vec![1.5_f32].into()), None),
PvValue::FloatArray(Arc::from([1.5_f64].as_slice()))
);
// CHAR waveform stays raw bytes (the formatter decides string vs array).
assert_eq!(
epics_to_pv(&EpicsValue::CharArray(vec![104, 105, 0]), None),
epics_to_pv(&EpicsValue::CharArray(vec![104, 105, 0].into()), None),
PvValue::Bytes(Arc::from([104_u8, 105, 0].as_slice()))
);
assert_eq!(
epics_to_pv(&EpicsValue::StringArray(vec!["a".into(), "b".into()]), None),
epics_to_pv(
&EpicsValue::StringArray(vec!["a".into(), "b".into()].into()),
None
),
PvValue::StrArray(Arc::from(["a".to_owned(), "b".to_owned()].as_slice()))
);
}
Expand Down Expand Up @@ -1050,19 +1063,19 @@ mod tests {
Some(DbFieldType::Double),
None
),
Some(EpicsValue::DoubleArray(vec![1.0, 2.0]))
Some(EpicsValue::DoubleArray(vec![1.0, 2.0].into()))
);
assert_eq!(
pv_to_epics(
&PvValue::IntArray(Arc::from([3_i64, 4].as_slice())),
Some(DbFieldType::Long),
None
),
Some(EpicsValue::Int64Array(vec![3, 4]))
Some(EpicsValue::Int64Array(vec![3, 4].into()))
);
assert_eq!(
pv_to_epics(&PvValue::Bytes(Arc::from([1_u8, 2].as_slice())), None, None),
Some(EpicsValue::CharArray(vec![1, 2]))
Some(EpicsValue::CharArray(vec![1, 2].into()))
);
}
}
14 changes: 7 additions & 7 deletions rsdm/src/data_plugins/epics_plugins/pva_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ mod tests {
#[test]
fn typed_arrays_map_to_waveforms() {
let root = ntscalar(
PvField::ScalarArrayTyped(TypedScalarArray::Double(Arc::from([1.0, 2.0, 3.0]))),
PvField::ScalarArrayTyped(TypedScalarArray::Double([1.0, 2.0, 3.0].into())),
0,
1,
0,
Expand All @@ -1334,7 +1334,7 @@ mod tests {
);

let root = ntscalar(
PvField::ScalarArrayTyped(TypedScalarArray::Long(Arc::from([3_i64, 4]))),
PvField::ScalarArrayTyped(TypedScalarArray::Long([3_i64, 4].into())),
0,
1,
0,
Expand All @@ -1348,7 +1348,7 @@ mod tests {

// A UByte array is a CHAR waveform → raw bytes (matching CA).
let root = ntscalar(
PvField::ScalarArrayTyped(TypedScalarArray::UByte(Arc::from([104_u8, 105, 0]))),
PvField::ScalarArrayTyped(TypedScalarArray::UByte([104_u8, 105, 0].into())),
0,
1,
0,
Expand Down Expand Up @@ -1610,7 +1610,7 @@ mod tests {
let mut table = PvStructure::new("");
table.set(
"col",
PvField::ScalarArrayTyped(TypedScalarArray::Double(Arc::from([1.5, 2.5].as_slice()))),
PvField::ScalarArrayTyped(TypedScalarArray::Double([1.5, 2.5].into())),
);
let mut root = PvStructure::new("epics:nt/NTTable:1.0");
root.set("value", PvField::Structure(table));
Expand Down Expand Up @@ -1644,7 +1644,7 @@ mod tests {
selector: 5,
variant_name: "ubyteValue".to_owned(),
value: Box::new(PvField::ScalarArrayTyped(TypedScalarArray::UByte(
Arc::from([1u8, 2, 3, 4].as_slice()),
[1u8, 2, 3, 4].into(),
))),
};
assert_eq!(
Expand All @@ -1657,7 +1657,7 @@ mod tests {
selector: 10,
variant_name: "doubleValue".to_owned(),
value: Box::new(PvField::ScalarArrayTyped(TypedScalarArray::Double(
Arc::from([0.5, 1.5].as_slice()),
[0.5, 1.5].into(),
))),
};
assert_eq!(
Expand Down Expand Up @@ -1697,7 +1697,7 @@ mod tests {
selector: 5,
variant_name: "ubyteValue".to_owned(),
value: Box::new(PvField::ScalarArrayTyped(TypedScalarArray::UByte(
Arc::from(payload),
payload.into(),
))),
},
);
Expand Down
6 changes: 3 additions & 3 deletions rsdm/tests/pva_ioc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ fn pva_ntndarray_ubyte_image_lands_as_bytes() {
source,
"rsdm:test:pva:img",
nt_nd_array_desc(),
nt_nd_array_value(&nd_array(NdArrayBuffer::UByte(vec![1, 2, 3, 4]), "")),
nt_nd_array_value(&nd_array(NdArrayBuffer::UByte(vec![1, 2, 3, 4].into()), "")),
);
});

Expand Down Expand Up @@ -340,7 +340,7 @@ fn pva_compressed_ntndarray_decodes_lz4_end_to_end() {
// (pva_codec.py:36-38) and the image lands as `Bytes`.
let img: Vec<u8> = (0..4096u32).map(|i| (i % 251) as u8).collect();
let compressed = lz4_flex::block::compress(&img);
let mut array = nd_array(NdArrayBuffer::UByte(compressed), "lz4");
let mut array = nd_array(NdArrayBuffer::UByte(compressed.into()), "lz4");
array.uncompressed_size = img.len() as i64;
let (engine, _server, _server_rt) = pva_engine(|source| {
add_pv(
Expand Down Expand Up @@ -376,7 +376,7 @@ fn pva_undecodable_compressed_ntndarray_connects_without_a_value() {
source,
"rsdm:test:pva:imgbad",
nt_nd_array_desc(),
nt_nd_array_value(&nd_array(NdArrayBuffer::UByte(vec![9, 9]), "blosc")),
nt_nd_array_value(&nd_array(NdArrayBuffer::UByte(vec![9, 9].into()), "blosc")),
);
});

Expand Down
Loading