pub struct AuthState {
pub key_store: Arc<KeyStore>,
pub counters: Arc<RuntimeCounters>,
}Expand description
REST auth middleware 的组合 state:KeyStore(谁能进)+ RuntimeCounters(限额)
非动态 endpoint 的 middleware scope 检查会按既有路径运行
check_and_commit。real/simulate write 因需要先解析 body 的 trd_env,
改由 handler 在 exact scope 通过后跑同一次全局 rate/hours 闸门。
精细化检查(daily / per_order / side / 具体 market)仍留给下游 handler。
Fields§
§key_store: Arc<KeyStore>keys.json 热可替换 key store(共享同一 [KeyStore] 确保 /reload 生效)
counters: Arc<RuntimeCounters>日累计 / 速率窗口 / rate-limit 的全局计数器;REST / gRPC / MCP 应共用 同一实例才能保证限额跨接口一致
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AuthState
impl !UnwindSafe for AuthState
impl Freeze for AuthState
impl Send for AuthState
impl Sync for AuthState
impl Unpin for AuthState
impl UnsafeUnpin for AuthState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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