Skip to main content

PriceReminderCooldownCache

Struct PriceReminderCooldownCache 

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

PriceReminder cooldown cache.

双层结构对齐 C++ m_mapNumExceedTime + m_mapStockExceedTime:

  • total_exceed: LimitMarket → svr_secs (NUM_LIMIT cooldown)
  • stock_exceed: (stock_id, reminder_type) → svr_secs (TYPE_NUM_LIMIT cooldown)

所有时间戳是 server clock seconds (与 C++ GetSvrTimeStamp() 对齐) — caller 必须传 server clock derived now, 不能传本机 wall clock (避免 daemon 长跑 + svr time skew 导致 cooldown 提前 / 延迟过期).

Implementations§

Source§

impl PriceReminderCooldownCache

Source

pub fn new() -> Arc<Self>

Source

pub fn is_total_exceeded(&self, market: LimitMarket, now_secs: i64) -> bool

Add op 前检查: 该 LimitMarket 是否仍在 10min cooldown 内.

对齐 C++ IsTotalPriceReminderNumExceed(enLimitMkt).

Source

pub fn is_stock_exceeded( &self, stock_id: u64, reminder_type: u32, now_secs: i64, ) -> bool

Add op 前检查: 该 (stock_id, reminder_type) 是否仍在 10min cooldown 内.

对齐 C++ IsStockPriceReminderNumExceed(nSecID, enRemindType).

Source

pub fn commit_total_exceeded(&self, market: LimitMarket, svr_now_secs: i64)

backend ack RSP_CODE_NUM_LIMIT (=2) 后 commit cooldown — F1 ack-then-commit 语义.

对齐 C++ SetTotalPriceReminderNumExceed.

Source

pub fn commit_stock_exceeded( &self, stock_id: u64, reminder_type: u32, svr_now_secs: i64, )

backend ack RSP_CODE_TYPE_NUM_LIMIT (=4) 后 commit cooldown — F1 ack-then-commit 语义.

对齐 C++ SetStockPriceReminderNumExceed.

Source

pub fn reset_total_exceeded(&self, market: LimitMarket)

Del / DelAll 成功后 reset 该 LimitMarket cooldown.

对齐 C++ ResetTotalPriceReminderNumExceed.

Source

pub fn reset_stock_exceeded(&self, stock_id: u64, reminder_type: u32)

Del 成功后 reset 该 (stock_id, type) cooldown.

对齐 C++ ResetStockPriceReminderNumExceed(nSecID, enRemindType) (非 None 分支).

Source

pub fn reset_stock_all(&self, stock_id: u64)

DelAll 成功后 reset 该 stock_id 下所有 reminder_type cooldown.

对齐 C++ ResetStockPriceReminderNumExceed(nSecID, NN_PriceReminderType_None) 分支 — 整 stock 一起 erase.

Trait Implementations§

Source§

impl Debug for PriceReminderCooldownCache

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PriceReminderCooldownCache

Source§

fn default() -> PriceReminderCooldownCache

Returns the “default value” for a type. 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.

§

impl<T> Instrument for T

§

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

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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