pub struct VirtualCurrencyReader { /* private fields */ }Implementations§
Source§impl VirtualCurrencyReader
impl VirtualCurrencyReader
pub fn new(store: Arc<CacheStore>, identity: Arc<IdentityManager>) -> Self
pub fn with_http(self, http: Arc<HttpClient>) -> Self
pub fn with_observer_bus(self, bus: Arc<ObserverBus>) -> Self
pub fn with_clock(self, clock: Arc<dyn Clock>) -> Self
Sourcepub fn balances(&self) -> BTreeMap<String, i64>
pub fn balances(&self) -> BTreeMap<String, i64>
All cached balances for the current user scope (code → balance).
Sourcepub fn refresh(&self) -> RovenueResult<()>
pub fn refresh(&self) -> RovenueResult<()>
GET /v1/virtual-currencies/me → replace the cached balance set.
Sourcepub fn set_balances(
&self,
scope: &str,
balances: &BTreeMap<String, i64>,
now_ms: u64,
) -> RovenueResult<()>
pub fn set_balances( &self, scope: &str, balances: &BTreeMap<String, i64>, now_ms: u64, ) -> RovenueResult<()>
Persist a balance set and emit VirtualCurrenciesChanged if it changed.
Stamps freshness so background coalescing (maybe_refresh_async) settles.
pub fn maybe_refresh_async(self: &Arc<Self>, staleness_ms: u64)
Auto Trait Implementations§
impl !Freeze for VirtualCurrencyReader
impl !RefUnwindSafe for VirtualCurrencyReader
impl Send for VirtualCurrencyReader
impl Sync for VirtualCurrencyReader
impl Unpin for VirtualCurrencyReader
impl !UnwindSafe for VirtualCurrencyReader
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