pub struct SessionBuffer { /* private fields */ }Implementations§
Source§impl SessionBuffer
impl SessionBuffer
pub fn new(store: Arc<CacheStore>) -> Self
Sourcepub fn record(
&self,
rovenue_id: &str,
kind: SessionEventKind,
occurred_at: &str,
duration_ms: Option<u32>,
) -> RovenueResult<()>
pub fn record( &self, rovenue_id: &str, kind: SessionEventKind, occurred_at: &str, duration_ms: Option<u32>, ) -> RovenueResult<()>
Buffer one event under rovenue_id, the wire identity current when it
happened; the dispatcher posts it under that identity even after a
log out.
Sourcepub fn peek(&self, limit: usize) -> RovenueResult<Vec<SessionEventRow>>
pub fn peek(&self, limit: usize) -> RovenueResult<Vec<SessionEventRow>>
Read up to limit buffered events WITHOUT removing them. The dispatcher
removes them (via delete) only after the server
confirms receipt, so a 503 (Kafka down) / network failure retains the
batch for the next flush instead of dropping it. Growth is bounded by
the store’s FIFO cap (newest 1000) applied on append.
Sourcepub fn delete(&self, ids: &[i64]) -> RovenueResult<()>
pub fn delete(&self, ids: &[i64]) -> RovenueResult<()>
Remove the given event ids — called only after a successful dispatch.
Auto Trait Implementations§
impl Freeze for SessionBuffer
impl RefUnwindSafe for SessionBuffer
impl Send for SessionBuffer
impl Sync for SessionBuffer
impl Unpin for SessionBuffer
impl UnwindSafe for SessionBuffer
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