pub struct FileEvaluationResultStore { /* private fields */ }Expand description
A durable implementation of EvaluationResultSink.
Each mutation reads and validates one complete generation while holding a
process-local mutex and an fs2 cross-process lock, then publishes a
synced temporary file with an atomic replacement. Reads are safe during a
replacement because they observe either the old or the new generation.
Implementations§
Source§impl FileEvaluationResultStore
impl FileEvaluationResultStore
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
Construct a store using the default bounded retention policy.
Sourcepub fn with_max_records(
root: impl Into<PathBuf>,
max_records: usize,
) -> Result<Self, EvaluationStoreError>
pub fn with_max_records( root: impl Into<PathBuf>, max_records: usize, ) -> Result<Self, EvaluationStoreError>
Construct a store with an explicit positive record-retention bound.
Sourcepub async fn open(
root: impl Into<PathBuf>,
) -> Result<Self, EvaluationStoreError>
pub async fn open( root: impl Into<PathBuf>, ) -> Result<Self, EvaluationStoreError>
Open and validate an existing generation before admitting it to a host. A missing file is a valid empty store; malformed or newer data is returned as an error immediately.
pub async fn open_with_max_records( root: impl Into<PathBuf>, max_records: usize, ) -> Result<Self, EvaluationStoreError>
pub fn root(&self) -> &Path
pub fn max_records(&self) -> usize
Sourcepub async fn validate_store(&self) -> Result<usize, EvaluationStoreError>
pub async fn validate_store(&self) -> Result<usize, EvaluationStoreError>
Validate and count the currently persisted generation.
Unlike the compatibility EvaluationResultSink::get and
list_for_target methods, this method returns storage errors so a host
can fail closed on corruption instead of treating it as an empty store.
pub async fn get_checked( &self, record_digest: &str, ) -> Result<Option<EvaluationRecordV1>, EvaluationStoreError>
pub async fn list_for_target_checked( &self, target: &ExecutionTargetV1, ) -> Result<Vec<EvaluationRecordV1>, EvaluationStoreError>
Trait Implementations§
Source§impl Clone for FileEvaluationResultStore
impl Clone for FileEvaluationResultStore
Source§fn clone(&self) -> FileEvaluationResultStore
fn clone(&self) -> FileEvaluationResultStore
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 FileEvaluationResultStore
impl Debug for FileEvaluationResultStore
Source§impl EvaluationResultSink for FileEvaluationResultStore
impl EvaluationResultSink for FileEvaluationResultStore
fn write<'life0, 'async_trait>(
&'life0 self,
record: EvaluationRecordV1,
) -> Pin<Box<dyn Future<Output = Result<EvaluationWriteOutcomeV1, EvaluationStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
record_digest: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<EvaluationRecordV1>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_for_target<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 ExecutionTargetV1,
) -> Pin<Box<dyn Future<Output = Vec<EvaluationRecordV1>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
record_digest: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<EvaluationRecordV1>, EvaluationStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
record_digest: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<EvaluationRecordV1>, EvaluationStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_for_target_checked<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 ExecutionTargetV1,
) -> Pin<Box<dyn Future<Output = Result<Vec<EvaluationRecordV1>, EvaluationStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for FileEvaluationResultStore
impl !UnwindSafe for FileEvaluationResultStore
impl Freeze for FileEvaluationResultStore
impl Send for FileEvaluationResultStore
impl Sync for FileEvaluationResultStore
impl Unpin for FileEvaluationResultStore
impl UnsafeUnpin for FileEvaluationResultStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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