Skip to main content

TuneWriteRow

Struct TuneWriteRow 

Source
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 the operation writes and verifies P, then I, then D in sequence, stopping at the first failure. A partial attempt leaves 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: WriteKind

Whether this row is a normal write-back or bhtune history revert undoing one. See WriteKind.

§allow_uncertain_quality: bool

Whether 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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for TuneWriteRow

Source§

fn clone(&self) -> TuneWriteRow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TuneWriteRow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TuneWriteRow

Source§

fn eq(&self, other: &TuneWriteRow) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TuneWriteRow

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more