pub struct PlacementsClient { /* private fields */ }Implementations§
Source§impl PlacementsClient
impl PlacementsClient
pub fn new(http: Arc<HttpClient>, store: Arc<CacheStore>) -> Self
pub fn with_clock(self, clock: Arc<dyn Clock>) -> Self
Sourcepub fn set_fallback(&self, entries: HashMap<String, String>)
pub fn set_fallback(&self, entries: HashMap<String, String>)
Replace the in-memory bundled-fallback-file map wholesale (called
once by RovenueCore::set_fallback_placements, after
fallback::parse_fallback_file has already validated the file and
decoded each entry once to confirm it parses as PlacementsResponse
— the raw strings stored here are re-decoded lazily per
get_funnel call, same as the disk cache).
Sourcepub fn get_funnel(
&self,
identifier: &str,
locale: Option<&str>,
subscriber_id: &str,
server_assignment: &dyn Fn(&str) -> Option<String>,
) -> RovenueResult<Option<CoreFunnel>>
pub fn get_funnel( &self, identifier: &str, locale: Option<&str>, subscriber_id: &str, server_assignment: &dyn Fn(&str) -> Option<String>, ) -> RovenueResult<Option<CoreFunnel>>
Fetch + resolve GET /v1/placements/{identifier}?locale= into the
funnel the placement serves.
Ok(None) means the placement resolved to nothing — unknown/inactive
placement, a target: none row, a retired reference, or no row
matched. This is NOT an error: a shipped app must never crash
because a placement was retired server-side.
On a successful live fetch the raw response JSON is cached under
placement:{identifier}. On NetworkUnavailable/Timeout the last
cached response (if any) is re-resolved instead (a fresh bucket draw
runs against the cached experiment payload). If there’s no cached
response either, the bundled fallback map (see set_fallback) is
consulted as a last resort — cache always beats fallback, and the
fallback is only ever consulted on this same connectivity-class
branch (never for auth/server errors, which propagate exactly as
before). Any other error propagates unchanged.
server_assignment(experiment_key) returns the variant the server
already assigned this subscriber (the Remote Config cache), if any.
It wins over the local draw, which otherwise disagrees with the
server after two devices merge into one subscriber (see
resolve_funnel).