pub struct TuneSampleRow {
pub id: i64,
pub run_id: i64,
pub tick_index: i64,
pub sample: Tick,
pub state: MrftState,
pub pv_quality: SampleQuality,
}Expand description
One row of tune_samples: a single tick’s [Tick] input and resulting [MrftState].
Fields§
§id: i64§run_id: i64§tick_index: i640-based sample sequence number within the run. Named tick_index rather than tick
to avoid colliding with the unrelated [Tick] type held in sample.
sample: Tick§state: MrftState§pv_quality: SampleQualityThe driver-reported quality of sample.pv at the moment it was read. See
SampleQuality.
Implementations§
Source§impl TuneSampleRow
impl TuneSampleRow
Sourcepub async fn insert(
pool: &SqlitePool,
run_id: i64,
tick_index: i64,
sample: Tick,
state: MrftState,
pv_quality: SampleQuality,
) -> DbResult<TuneSampleRow>
pub async fn insert( pool: &SqlitePool, run_id: i64, tick_index: i64, sample: Tick, state: MrftState, pv_quality: SampleQuality, ) -> DbResult<TuneSampleRow>
Records one tick of a run, taking the exact [Tick]/[MrftState] pair
[bhtune_core::mrft::MrftEngine::step] produced, plus the SampleQuality the
driver reported for sample.pv at read time. (run_id, tick_index) is unique (see
the migration), so re-recording the same tick twice is a caller bug, not a silent
overwrite.
Sourcepub async fn list_for_run(
pool: &SqlitePool,
run_id: i64,
) -> DbResult<Vec<TuneSampleRow>>
pub async fn list_for_run( pool: &SqlitePool, run_id: i64, ) -> DbResult<Vec<TuneSampleRow>>
Lists every sample of run_id, ordered by tick — the full per-tick trend shown on the
history page.
Sourcepub async fn list_for_run_since(
pool: &SqlitePool,
run_id: i64,
after_tick: i64,
) -> DbResult<Vec<TuneSampleRow>>
pub async fn list_for_run_since( pool: &SqlitePool, run_id: i64, after_tick: i64, ) -> DbResult<Vec<TuneSampleRow>>
Lists only the samples of run_id recorded after after_tick, ordered by tick –
what bhtune-server’s GET /api/runs/{id}/stream polls on
every iteration so it never re-sends a tick it has already pushed to the browser.
Pass -1 to fetch every sample from the very first tick (tune_samples.tick is
>= 0, so nothing is ever excluded by that sentinel).
Trait Implementations§
Source§impl Clone for TuneSampleRow
impl Clone for TuneSampleRow
Source§fn clone(&self) -> TuneSampleRow
fn clone(&self) -> TuneSampleRow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TuneSampleRow
Source§impl Debug for TuneSampleRow
impl Debug for TuneSampleRow
Source§impl PartialEq for TuneSampleRow
impl PartialEq for TuneSampleRow
impl StructuralPartialEq for TuneSampleRow
Auto Trait Implementations§
impl Freeze for TuneSampleRow
impl RefUnwindSafe for TuneSampleRow
impl Send for TuneSampleRow
impl Sync for TuneSampleRow
impl Unpin for TuneSampleRow
impl UnsafeUnpin for TuneSampleRow
impl UnwindSafe for TuneSampleRow
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> ⓘ
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