Skip to main content

EventQueue

Struct EventQueue 

Source
pub struct EventQueue { /* private fields */ }
Expand description

事件队列:攒批入队,满一批或距上次发送超过 flush_interval 时要求发送。

每条事件带 event_id 幂等键,重发不会在服务端产生重复。队列本身不发请求, 取批与提交由 crate::PublicApi 驱动。

Implementations§

Source§

impl EventQueue

Source

pub fn active(&self) -> bool

当前是否会采集。为 false 时不生成标识、不落盘、不发请求。

Source

pub fn has_opted_out(&self) -> bool

当前是否处于退出状态。

Source

pub fn opt_out(&self)

停止采集、丢弃待发队列、删除本地匿名标识,并把退出标记写入本地。

Source

pub fn opt_in(&self)

撤销退出,并生成一个新的匿名标识。

require_consent 模式下开闸。在此之前不会有任何字节写入设备。

撤回同意,等价于 EventQueue::opt_out 并回到未同意状态。

Source

pub fn reset_identity(&self)

换一个新的匿名标识,切断与既往事件序列的关联。

Source

pub fn current_distinct_id(&self) -> Option<String>

当前的匿名标识;未采集状态下返回 None,且不会顺带生成一个。

Source

pub fn namespace(&self) -> &str

本地状态的命名空间。绑定项目变了就该按新命名空间重建队列。

Source

pub fn pending(&self) -> usize

队列里还剩多少条。

Trait Implementations§

Source§

impl Debug for EventQueue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more