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.
Trait Implementations§
Source§impl Debug for PriceReminderCooldownCache
impl Debug for PriceReminderCooldownCache
Source§impl Default for PriceReminderCooldownCache
impl Default for PriceReminderCooldownCache
Source§fn default() -> PriceReminderCooldownCache
fn default() -> PriceReminderCooldownCache
Auto Trait Implementations§
impl !RefUnwindSafe for PriceReminderCooldownCache
impl Freeze for PriceReminderCooldownCache
impl Send for PriceReminderCooldownCache
impl Sync for PriceReminderCooldownCache
impl Unpin for PriceReminderCooldownCache
impl UnsafeUnpin for PriceReminderCooldownCache
impl UnwindSafe for PriceReminderCooldownCache
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more