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
impl PriceReminderCooldownCache
pub fn new() -> Arc<Self>
Sourcepub fn is_total_exceeded(&self, market: LimitMarket, now_secs: i64) -> bool
pub fn is_total_exceeded(&self, market: LimitMarket, now_secs: i64) -> bool
Add op 前检查: 该 LimitMarket 是否仍在 10min cooldown 内.
对齐 C++ IsTotalPriceReminderNumExceed(enLimitMkt).
Sourcepub fn is_stock_exceeded(
&self,
stock_id: u64,
reminder_type: u32,
now_secs: i64,
) -> bool
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).
Sourcepub fn commit_total_exceeded(&self, market: LimitMarket, svr_now_secs: i64)
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.
Sourcepub fn commit_stock_exceeded(
&self,
stock_id: u64,
reminder_type: u32,
svr_now_secs: i64,
)
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.
Sourcepub fn reset_total_exceeded(&self, market: LimitMarket)
pub fn reset_total_exceeded(&self, market: LimitMarket)
Del / DelAll 成功后 reset 该 LimitMarket cooldown.
对齐 C++ ResetTotalPriceReminderNumExceed.
Sourcepub fn reset_stock_exceeded(&self, stock_id: u64, reminder_type: u32)
pub fn reset_stock_exceeded(&self, stock_id: u64, reminder_type: u32)
Del 成功后 reset 该 (stock_id, type) cooldown.
对齐 C++ ResetStockPriceReminderNumExceed(nSecID, enRemindType)
(非 None 分支).
Sourcepub fn reset_stock_all(&self, stock_id: u64)
pub fn reset_stock_all(&self, stock_id: u64)
DelAll 成功后 reset 该 stock_id 下所有 reminder_type cooldown.
对齐 C++ ResetStockPriceReminderNumExceed(nSecID, NN_PriceReminderType_None)
分支 — 整 stock 一起 erase.