From c62f0333b0a854a39e7616cf933bc14794682aa4 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Fri, 6 Nov 2026 07:31:13 +0900 Subject: [PATCH 1/2] chore(rsdm): bump epics-ca-rs/base-rs/pva-rs to 0.34.0 get_with_metadata now takes its bound; CTRL_READ_TIMEOUT keeps the 30 s 0.24 applied inside it. Array payloads became SharedArray/PvArray, so pv_to_epics hands its Arc<[T]> buffers over instead of copying them. --- CHANGELOG.md | 11 ++++++ rsdm/Cargo.toml | 12 +++--- .../data_plugins/epics_plugins/ca_plugin.rs | 39 ++++++++++++------- .../data_plugins/epics_plugins/pva_plugin.rs | 14 +++---- rsdm/tests/pva_ioc.rs | 6 +-- 5 files changed, 53 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57f26f4..4f9aa05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,17 @@ 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. + ## [0.6.1] - 2026-10-18 ### Fixed diff --git a/rsdm/Cargo.toml b/rsdm/Cargo.toml index 13f4915..b7fb3ea 100644 --- a/rsdm/Cargo.toml +++ b/rsdm/Cargo.toml @@ -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 diff --git a/rsdm/src/data_plugins/epics_plugins/ca_plugin.rs b/rsdm/src/data_plugins/epics_plugins/ca_plugin.rs index af40cb5..3a9a70c 100644 --- a/rsdm/src/data_plugins/epics_plugins/ca_plugin.rs +++ b/rsdm/src/data_plugins/epics_plugins/ca_plugin.rs @@ -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 { @@ -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> = snap .enums @@ -415,7 +422,10 @@ async fn on_property_change( enum_cache: &mut Option>, ) { // 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> = snap .enums .as_ref() @@ -592,12 +602,12 @@ fn pv_to_epics( ) -> Option { 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), } } @@ -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())) ); } @@ -1050,7 +1063,7 @@ 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( @@ -1058,11 +1071,11 @@ mod tests { 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())) ); } } diff --git a/rsdm/src/data_plugins/epics_plugins/pva_plugin.rs b/rsdm/src/data_plugins/epics_plugins/pva_plugin.rs index 4c731e8..61ff852 100644 --- a/rsdm/src/data_plugins/epics_plugins/pva_plugin.rs +++ b/rsdm/src/data_plugins/epics_plugins/pva_plugin.rs @@ -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, @@ -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, @@ -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, @@ -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)); @@ -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!( @@ -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!( @@ -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(), ))), }, ); diff --git a/rsdm/tests/pva_ioc.rs b/rsdm/tests/pva_ioc.rs index b6c4393..f403e00 100644 --- a/rsdm/tests/pva_ioc.rs +++ b/rsdm/tests/pva_ioc.rs @@ -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()), "")), ); }); @@ -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 = (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( @@ -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")), ); }); From 675a75a59d7ea0dfa66ddf153685b6fd6a91ca92 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Fri, 6 Nov 2026 09:37:58 +0900 Subject: [PATCH 2/2] build(rsdm): raise rust-version to 1.98 for epics-rs 0.34 epics-base-rs 0.34.0 calls isolate_lowest_one, stable since 1.97, so 1.96.1 stops on E0658; 1.98.0 builds the workspace. rsplot and adl2rsdm do not depend on epics-rs and keep 1.95. --- CHANGELOG.md | 3 +++ rsdm/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9aa05..52c2931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ library), **rsdm** (a PyDM-style EPICS display layer built on rsplot), and - 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 diff --git a/rsdm/Cargo.toml b/rsdm/Cargo.toml index b7fb3ea..db5d403 100644 --- a/rsdm/Cargo.toml +++ b/rsdm/Cargo.toml @@ -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"