Skip to main content

StoredStateSeriesReader

Struct StoredStateSeriesReader 

Source
pub struct StoredStateSeriesReader { /* private fields */ }
Expand description

Reader that reconstructs complete in-memory series from one completed recording.

Construction consumes the decoder registry so decoder configuration and metadata remain one coherent read authority. The type is intentionally non-Clone because registered decoders may not have meaningful clone semantics.

Implementations§

Source§

impl StoredStateSeriesReader

Source

pub fn open_completed_recording( root: impl AsRef<Path>, decoders: JsonPayloadDecoderRegistry, ) -> Result<Self, StorageError>

Opens one recording directory and validates its authoritative metadata.

The metadata snapshot must declare successful completion. Reading an active or failed recording is deliberately rejected because its chunk inventory is not a complete analysis result.

Decoder coverage is checked per selected stream by StoredStateSeriesReader::read_stream_as_state_series, allowing one registry to serve only the streams an analysis intends to load.

§Errors

Returns StorageError::Io when metadata.json cannot be read, StorageError::Json when it is not syntactically valid JSON, semantic metadata errors from internal RecordingMetadata::validate, or StorageError::RecordingNotComplete unless status is complete.

Source

pub fn recording_directory(&self) -> &Path

Returns the recording directory exactly as supplied at construction.

Source

pub fn stream_names(&self) -> impl ExactSizeIterator<Item = &str>

Iterates declared stream names in deterministic metadata order.

Source

pub fn format_version(&self) -> u32

Returns the validated storage format version.

Source

pub fn user_metadata(&self) -> &Map<String, Value>

Borrows immutable metadata supplied when recording began.

Source

pub fn terminal_metadata(&self) -> &Map<String, Value>

Borrows values committed only at successful completion.

Source

pub fn recording_timing(&self) -> &RecordingTiming

Borrows automatic operational timing for the completed recording.

Source

pub fn stream_record_count(&self, stream: &str) -> Result<u64, StorageError>

Returns the metadata-declared record count for one completed stream.

Source

pub fn stream_encoded_bytes(&self, stream: &str) -> Result<u64, StorageError>

Returns the exact metadata-declared encoded bytes for one stream.

Source

pub fn read_stream_as_state_series( &self, stream: &str, ) -> Result<StateSeries, StorageError>

Reconstructs one named logical stream as a complete StateSeries.

The method validates decoder coverage before opening chunk files. It then checks every chunk’s filesystem length, processes its complete JSONL records in order, verifies descriptor record/index facts and SHA-256, and appends only fully decoded states to the private series.

§Errors

Returns precise stream-selection, decoder, filesystem, integrity, record, payload-conversion, or series-invariant errors. No partially reconstructed series is returned on failure.

Source

pub fn read_all_streams_as_state_series( &self, ) -> Result<Vec<(String, StateSeries)>, StorageError>

Reconstructs every declared stream in metadata order.

Distinct stream schemas and sampling intervals remain distinct series. If any stream fails, already reconstructed series are dropped and no partial vector is returned.

Source

pub fn read_latest_state_from_stream( &self, stream: &str, ) -> Result<SystemState, StorageError>

Reconstructs only the latest state in one completed stream.

Earlier chunks are not opened. The newest chunk’s length and checksum are verified, then its final newline-terminated record is decoded into the stream’s partial schema. This is suitable for final-value analysis; use checkpoint continuation when the state must cover a complete model schema and remain appendable.

Trait Implementations§

Source§

impl Debug for StoredStateSeriesReader

Source§

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

Formats bounded configuration without decoder internals or payloads.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.