pub struct RemoteConfigReader { /* private fields */ }Expand description
Reads Remote Config (feature flags + experiment assignments) from
GET /v1/config, caching the last-known payload both in memory and on disk
so flags resolve instantly and survive offline. Mirrors the offerings/
entitlements readers: a 60s scheduler tick refreshes in the background and
reads coalesce a single staleness-driven refresh.
Implementations§
Source§impl RemoteConfigReader
impl RemoteConfigReader
pub fn new( http: Arc<HttpClient>, store: Arc<CacheStore>, identity: Arc<IdentityManager>, ) -> Self
pub fn with_clock(self, clock: Arc<dyn Clock>) -> Self
pub fn with_observer_bus(self, bus: Arc<ObserverBus>) -> Self
Sourcepub fn refresh(&self) -> RovenueResult<()>
pub fn refresh(&self) -> RovenueResult<()>
Force a synchronous refresh from the server.
Sourcepub fn maybe_refresh_async(&self, staleness_ms: u64)
pub fn maybe_refresh_async(&self, staleness_ms: u64)
Trigger one coalesced background refresh if the cached payload is older
than staleness_ms. Never blocks the caller; multiple concurrent reads
collapse into a single in-flight GET.
pub fn bool(&self, key: &str, fallback: bool) -> bool
pub fn string(&self, key: &str, fallback: String) -> String
pub fn int(&self, key: &str, fallback: i64) -> i64
pub fn double(&self, key: &str, fallback: f64) -> f64
Sourcepub fn json(&self, key: &str) -> Option<String>
pub fn json(&self, key: &str) -> Option<String>
Raw JSON string for any present flag (primitive, object, or array).
None when the key is absent.
pub fn keys(&self) -> Vec<String>
pub fn experiment(&self, key: &str) -> Option<ExperimentAssignment>
pub fn experiments_all(&self) -> Vec<ExperimentAssignment>
Auto Trait Implementations§
impl Freeze for RemoteConfigReader
impl !RefUnwindSafe for RemoteConfigReader
impl Send for RemoteConfigReader
impl Sync for RemoteConfigReader
impl Unpin for RemoteConfigReader
impl !UnwindSafe for RemoteConfigReader
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