pub struct NimbusClient { /* private fields */ }
Expand description
Nimbus is the main struct representing the experiments state It should hold all the information needed to communicate a specific user’s experimentation status
Implementations§
source§impl NimbusClient
impl NimbusClient
pub fn new<P: Into<PathBuf>>( app_context: AppContext, recorded_context: Option<Arc<dyn RecordedContext>>, coenrolling_feature_ids: Vec<String>, db_path: P, config: Option<RemoteSettingsConfig>, metrics_handler: Box<dyn MetricsHandler>, ) -> Result<Self>
pub fn with_targeting_attributes( &mut self, targeting_attributes: TargetingAttributes, )
pub fn get_targeting_attributes(&self) -> TargetingAttributes
pub fn initialize(&self) -> Result<()>
pub fn get_enrollment_by_feature( &self, feature_id: String, ) -> Result<Option<EnrolledFeature>>
pub fn get_experiment_branch(&self, slug: String) -> Result<Option<String>>
pub fn get_feature_config_variables( &self, feature_id: String, ) -> Result<Option<String>>
pub fn get_experiment_branches( &self, slug: String, ) -> Result<Vec<ExperimentBranch>>
pub fn get_global_user_participation(&self) -> Result<bool>
pub fn set_global_user_participation( &self, user_participating: bool, ) -> Result<Vec<EnrollmentChangeEvent>>
pub fn get_active_experiments(&self) -> Result<Vec<EnrolledExperiment>>
pub fn get_all_experiments(&self) -> Result<Vec<Experiment>>
pub fn get_available_experiments(&self) -> Result<Vec<AvailableExperiment>>
pub fn opt_in_with_branch( &self, experiment_slug: String, branch: String, ) -> Result<Vec<EnrollmentChangeEvent>>
pub fn opt_out( &self, experiment_slug: String, ) -> Result<Vec<EnrollmentChangeEvent>>
pub fn fetch_experiments(&self) -> Result<()>
pub fn set_fetch_enabled(&self, allow: bool) -> Result<()>
pub fn apply_pending_experiments(&self) -> Result<Vec<EnrollmentChangeEvent>>
pub fn set_experiments_locally(&self, experiments_json: String) -> Result<()>
sourcepub fn reset_enrollments(&self) -> Result<()>
pub fn reset_enrollments(&self) -> Result<()>
Reset all enrollments and experiments in the database.
This should only be used in testing.
sourcepub fn reset_telemetry_identifiers(&self) -> Result<Vec<EnrollmentChangeEvent>>
pub fn reset_telemetry_identifiers(&self) -> Result<Vec<EnrollmentChangeEvent>>
Reset internal state in response to application-level telemetry reset.
When the user resets their telemetry state in the consuming application, we need learn the new values of any external randomization units, and we need to reset any unique identifiers used internally by the SDK. If we don’t then we risk accidentally tracking across the telemetry reset, since we could use Nimbus metrics to link their pings from before and after the reset.
pub fn nimbus_id(&self) -> Result<Uuid>
pub fn set_nimbus_id(&self, uuid: &Uuid) -> Result<()>
pub fn create_targeting_helper( &self, additional_context: Option<Map<String, Value>>, ) -> Result<Arc<NimbusTargetingHelper>>
pub fn create_targeting_helper_with_context( &self, context: Value, ) -> Arc<NimbusTargetingHelper>
pub fn create_string_helper( &self, additional_context: Option<Map<String, Value>>, ) -> Result<Arc<NimbusStringHelper>>
sourcepub fn record_event(&self, event_id: String, count: i64) -> Result<()>
pub fn record_event(&self, event_id: String, count: i64) -> Result<()>
Records an event for the purposes of behavioral targeting.
This function is used to record and persist data used for the behavioral targeting such as “core-active” user targeting.
sourcepub fn record_past_event(
&self,
event_id: String,
seconds_ago: i64,
count: i64,
) -> Result<()>
pub fn record_past_event( &self, event_id: String, seconds_ago: i64, count: i64, ) -> Result<()>
Records an event for the purposes of behavioral targeting.
This differs from the record_event
method in that the event is recorded as if it were
recorded seconds_ago
in the past. This makes it very useful for testing.
sourcepub fn advance_event_time(&self, by_seconds: i64) -> Result<()>
pub fn advance_event_time(&self, by_seconds: i64) -> Result<()>
Advances the event store’s concept of now
artificially.
This works alongside record_event
and record_past_event
for testing purposes.
sourcepub fn clear_events(&self) -> Result<()>
pub fn clear_events(&self) -> Result<()>
Clear all events in the Nimbus event store.
This should only be used in testing or cases where the previous event store is no longer viable.
pub fn event_store(&self) -> Arc<Mutex<EventStore>>
pub fn dump_state_to_log(&self) -> Result<()>
source§impl NimbusClient
impl NimbusClient
pub fn set_install_time(&mut self, then: DateTime<Utc>)
pub fn set_update_time(&mut self, then: DateTime<Utc>)
source§impl NimbusClient
impl NimbusClient
pub fn record_feature_exposure(&self, feature_id: String, slug: Option<String>)
pub fn record_malformed_feature_config( &self, feature_id: String, part_id: String, )
Auto Trait Implementations§
impl !Freeze for NimbusClient
impl !RefUnwindSafe for NimbusClient
impl Send for NimbusClient
impl Sync for NimbusClient
impl Unpin for NimbusClient
impl !UnwindSafe for NimbusClient
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<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Read more