pub struct ABTestManager { /* private fields */ }Expand description
Manager for multiple A/B tests
Implementations§
Source§impl ABTestManager
impl ABTestManager
Sourcepub fn create_test(&self, test: ABTest) -> Result<String, ABTestError>
pub fn create_test(&self, test: ABTest) -> Result<String, ABTestError>
Create a new A/B test
Sourcepub fn list_tests(&self) -> Vec<ABTest>
pub fn list_tests(&self) -> Vec<ABTest>
List all active tests
Sourcepub fn list_tests_by_status(&self, status: ABTestStatus) -> Vec<ABTest>
pub fn list_tests_by_status(&self, status: ABTestStatus) -> Vec<ABTest>
List tests by status
Sourcepub fn start_test(&self, test_id: &str) -> Result<(), ABTestError>
pub fn start_test(&self, test_id: &str) -> Result<(), ABTestError>
Start a test
Sourcepub fn pause_test(&self, test_id: &str) -> Result<(), ABTestError>
pub fn pause_test(&self, test_id: &str) -> Result<(), ABTestError>
Pause a test
Sourcepub fn resume_test(&self, test_id: &str) -> Result<(), ABTestError>
pub fn resume_test(&self, test_id: &str) -> Result<(), ABTestError>
Resume a test
Sourcepub fn complete_test(&self, test_id: &str) -> Result<ABTestResults, ABTestError>
pub fn complete_test(&self, test_id: &str) -> Result<ABTestResults, ABTestError>
Complete a test
Sourcepub fn archive_test(&self, test_id: &str) -> Result<(), ABTestError>
pub fn archive_test(&self, test_id: &str) -> Result<(), ABTestError>
Archive a test (move to archived storage)
Sourcepub fn delete_test(&self, test_id: &str) -> Result<(), ABTestError>
pub fn delete_test(&self, test_id: &str) -> Result<(), ABTestError>
Delete a test (permanent)
Sourcepub fn get_variant(
&self,
test_id: &str,
user_id: &str,
) -> Result<ABTestVariant, ABTestError>
pub fn get_variant( &self, test_id: &str, user_id: &str, ) -> Result<ABTestVariant, ABTestError>
Get variant for a user in a specific test
Sourcepub fn get_weights_for_user(
&self,
test_id: &str,
user_id: &str,
) -> Result<LearnedWeights, ABTestError>
pub fn get_weights_for_user( &self, test_id: &str, user_id: &str, ) -> Result<LearnedWeights, ABTestError>
Get weights for a user (handles test assignment)
Sourcepub fn record_impression(
&self,
test_id: &str,
user_id: &str,
relevance_score: f64,
latency_us: u64,
) -> Result<(), ABTestError>
pub fn record_impression( &self, test_id: &str, user_id: &str, relevance_score: f64, latency_us: u64, ) -> Result<(), ABTestError>
Record an impression
Sourcepub fn record_click(
&self,
test_id: &str,
user_id: &str,
memory_id: Uuid,
) -> Result<(), ABTestError>
pub fn record_click( &self, test_id: &str, user_id: &str, memory_id: Uuid, ) -> Result<(), ABTestError>
Record a click
Sourcepub fn record_feedback(
&self,
test_id: &str,
user_id: &str,
positive: bool,
) -> Result<(), ABTestError>
pub fn record_feedback( &self, test_id: &str, user_id: &str, positive: bool, ) -> Result<(), ABTestError>
Record explicit feedback
Sourcepub fn analyze_test(&self, test_id: &str) -> Result<ABTestResults, ABTestError>
pub fn analyze_test(&self, test_id: &str) -> Result<ABTestResults, ABTestError>
Analyze a test
Sourcepub fn list_archived(&self) -> Vec<ABTest>
pub fn list_archived(&self) -> Vec<ABTest>
Get all archived tests
Sourcepub fn check_expired_tests(&self) -> Vec<String>
pub fn check_expired_tests(&self) -> Vec<String>
Check and auto-complete expired tests
Sourcepub fn summary(&self) -> ABTestManagerSummary
pub fn summary(&self) -> ABTestManagerSummary
Get summary of all tests
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ABTestManager
impl !RefUnwindSafe for ABTestManager
impl Send for ABTestManager
impl Sync for ABTestManager
impl Unpin for ABTestManager
impl UnsafeUnpin for ABTestManager
impl !UnwindSafe for ABTestManager
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 more