pub struct TuneWriteRow {Show 17 fields
pub id: i64,
pub run_id: i64,
pub response_level: ResponseLevel,
pub written_at: DateTime<Utc>,
pub kind: WriteKind,
pub allow_uncertain_quality: bool,
pub previous: Option<WriteReadback>,
pub proportional_written: Option<f32>,
pub integral_written: Option<f32>,
pub derivative_written: Option<f32>,
pub proportional_readback: Option<f32>,
pub integral_readback: Option<f32>,
pub derivative_readback: Option<f32>,
pub success: bool,
pub error_message: Option<String>,
pub rollback_state: Option<RollbackState>,
pub rollback_error: Option<String>,
}Expand description
One row of tune_writes: an audit record of PID constants actually written back to the
DCS for one ResponseLevel of one run, distinct from what was merely calculated
(TuneResultRow). Flattened for the same reason as TuneResultRow.
*_written/*_readback are independently nullable (not all-or-nothing like previous)
because safety-writeback-rollback writes and verifies P, then I, then D in sequence,
stopping at the first failure – so a partial attempt leaves the constants after the
failure point at None rather than 0, distinguishing “never attempted” from “attempted
and confirmed zero”.
Fields§
§id: i64§run_id: i64§response_level: ResponseLevel§written_at: DateTime<Utc>§kind: WriteKindWhether this row is a normal write-back or bhtune history revert undoing one. See
WriteKind.
allow_uncertain_quality: boolWhether this operation allowed Quality::Uncertain readings. This is
the explicit per-operation policy supplied at insertion time; it is
independent of TuneRunRow::allow_uncertain_quality.
previous: Option<WriteReadback>The P/I/D values read from the driver before any write was attempted. None only
when the pre-read itself failed – a hard stop before any write, so nothing else on
this row was ever attempted either (success = false, every other field below None).
proportional_written: Option<f32>§integral_written: Option<f32>§derivative_written: Option<f32>§proportional_readback: Option<f32>Read back immediately after writing to confirm the DCS accepted the value within
tolerance. None whenever the corresponding *_written field is None, or when the
write was sent but the readback attempt itself failed.
integral_readback: Option<f32>§derivative_readback: Option<f32>§success: bool§error_message: Option<String>§rollback_state: Option<RollbackState>Set only when success = false and at least one constant had already been written
before the failure, so a best-effort rollback to previous was attempted. None
means rollback did not apply – either every constant wrote successfully (success = true) or the pre-read failed before any write was attempted. Always None for a
kind = Revert row.
rollback_error: Option<String>Implementations§
Source§impl TuneWriteRow
impl TuneWriteRow
Sourcepub async fn insert(
pool: &SqlitePool,
run_id: i64,
new: NewTuneWrite,
) -> DbResult<TuneWriteRow>
pub async fn insert( pool: &SqlitePool, run_id: i64, new: NewTuneWrite, ) -> DbResult<TuneWriteRow>
Records one write-back attempt exactly as new describes it – see NewTuneWrite.
Sourcepub async fn list_for_run(
pool: &SqlitePool,
run_id: i64,
) -> DbResult<Vec<TuneWriteRow>>
pub async fn list_for_run( pool: &SqlitePool, run_id: i64, ) -> DbResult<Vec<TuneWriteRow>>
Lists every write-back attempt for run_id, oldest first — the full “who changed this
loop and when” audit trail history-writeback-audit exists to provide.
Trait Implementations§
Source§impl Clone for TuneWriteRow
impl Clone for TuneWriteRow
Source§fn clone(&self) -> TuneWriteRow
fn clone(&self) -> TuneWriteRow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TuneWriteRow
impl Debug for TuneWriteRow
Source§impl PartialEq for TuneWriteRow
impl PartialEq for TuneWriteRow
Source§fn eq(&self, other: &TuneWriteRow) -> bool
fn eq(&self, other: &TuneWriteRow) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TuneWriteRow
Auto Trait Implementations§
impl Freeze for TuneWriteRow
impl RefUnwindSafe for TuneWriteRow
impl Send for TuneWriteRow
impl Sync for TuneWriteRow
impl Unpin for TuneWriteRow
impl UnsafeUnpin for TuneWriteRow
impl UnwindSafe for TuneWriteRow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more