read_history_modified
If the server allows it ( HistoryUpdate
change history), the data may have been modified. read_history_modified
Retrieve all versions and change logs for auditing and regulatory compliance purposes.
Preliminary / Supporting
- For standard read access without auditing, please use ReadRaw.
- To write or edit history, please see HistoryUpdate.
Signature
pub fn Session::read_history_modified(
&self,
node_id: &str,
start: SystemTime,
end: SystemTime,
max_values: u32,
return_bounds: bool,
) -> Result<Vec<DataValue>, OpcUaError>;
| Parameters | Note |
|---|---|
| node_id | Objective NodeId |
| start / end | UTC Range |
| max_values | Upper limit; 0 = no limit |
| return_bounds | true = Returns the boundary points of the interval (interpolation/nearest value); false = Returns only the values within the interval |
Return Value
Vec<DataValue>. Each entry DataValue contains the complete modification record + Variant Status + Timestamp.
Currently, modification records SDK are returned in a flattened, chronological order—multiple entries (original + modified) may appear source_timestamp for the same entry DataValue,
and the client sorts and deduplicates them as needed.
Usage
use std::time::{Duration, SystemTime};
let now = SystemTime::now();
let yesterday = now - Duration::from_secs(86400);
let modified = s.read_history_modified(
"ns=2;s=Temperature",
yesterday, now,
/*max*/ 0, /*bounds*/ true,
)?;
for m in &modified {
println!("{:?}: {:?} ({})",
m.source_timestamp(), m.variant(), m.status());
}
When to Use
- Regulatory Compliance: Regulated industries (pharmaceuticals, food, etc.) require "data traceability"
- Audit Log: Who Changed the Key Parameters?
- Data Recovery Rollback: Know what the value was before the change
Server Requirements
- Must be implemented HistoryUpdate
- The revision history must be preserved (rather than overwritten).
- User credentials must be passed correctly (Username / Certificate Token)
Error
| StatusCode | Reason |
|---|---|
| BAD_HISTORY_OPERATION_UNSUPPORTED | Not supported on the server side ReadModified |
| BAD_NOT_READABLE | The node does not have permission HistoryRead. |
Difference from ReadRaw
| API | Return |
|---|---|
| read_history | The latest version at each point in time (versions prior to the update are not visible) |
| read_history_modified | All Versions at Each Point in Time + Change Log |