pub struct InMemoryExperimentLog { /* private fields */ }Expand description
In-process log for tests (and the no-Redis single-replica path, where it is never used).
Two ExperimentMonitor instances that hold Arcs to the same InMemoryExperimentLog will
converge to the same Experiment state after syncing, exactly as two remote replicas sharing
a Redis-backed log would.
Implementations§
Trait Implementations§
Source§impl Debug for InMemoryExperimentLog
impl Debug for InMemoryExperimentLog
Source§impl Default for InMemoryExperimentLog
impl Default for InMemoryExperimentLog
Source§impl ExperimentLogBackend for InMemoryExperimentLog
impl ExperimentLogBackend for InMemoryExperimentLog
Source§fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
route_ix: usize,
fingerprint: &'life2 str,
record: LogRecord,
) -> Pin<Box<dyn Future<Output = Result<u64, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
route_ix: usize,
fingerprint: &'life2 str,
record: LogRecord,
) -> Pin<Box<dyn Future<Output = Result<u64, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Append
record to the list. Returns the new list length (1-based), or an error if the
backend is unreachable. A failure means the pair/outcome will not reach other replicas,
but local accounting (health, ledger) was already performed by the caller.Source§fn load_since<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
route_ix: usize,
fingerprint: &'life2 str,
offset: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<LogRecord>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_since<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
route_ix: usize,
fingerprint: &'life2 str,
offset: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<LogRecord>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Return records starting at
offset (0-based). Each element is Some(record) for a valid
entry or None for a malformed one (failed to deserialize). The list length equals the
number of positions consumed: a None at index i still advances offset by 1. Empty
if the list has ≤ offset entries. Returns an error if the backend is unreachable; callers
use this to distinguish “truly empty” from “unreachable” and fail closed.Source§fn claim_session<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
route_ix: usize,
fingerprint: &'life2 str,
session_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn claim_session<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 str,
route_ix: usize,
fingerprint: &'life2 str,
session_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Atomically claim a session for this experiment (live mode session dedup across replicas). Read more
Auto Trait Implementations§
impl !Freeze for InMemoryExperimentLog
impl RefUnwindSafe for InMemoryExperimentLog
impl Send for InMemoryExperimentLog
impl Sync for InMemoryExperimentLog
impl Unpin for InMemoryExperimentLog
impl UnsafeUnpin for InMemoryExperimentLog
impl UnwindSafe for InMemoryExperimentLog
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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 moreCreates a shared type from an unshared type.