Skip to main content

Crate zenith_foundation

Crate zenith_foundation 

Source
Expand description

Zenith Core - 核心基础设施、所有权、通用组件

本 crate 实现 Zenith 框架的核心基础设施,包括:

  • 统一错误类型与错误处理规范
  • 所有权令牌(FrameToken)
  • Frame 池管理
  • 分层资源账本
  • 基础工具:恒定时间比较、配置系统、时间戳

§unsafe 边界声明

本 crate 顶层 #![deny(unsafe_code)],全 crate 零 unsafe。 (原 buffer 模块的 SPSC RingBuffer 例外已随死代码删除一并移除, AGENT.md §1.1 例外条款同步更新。)

Re-exports§

pub use backoff::exponential_backoff;
pub use backoff::exponential_backoff_with_jitter;
pub use config::CacheConfig;
pub use config::ConfigError;
pub use config::ObservabilityConfig;
pub use config::RuntimeConfig as RuntimeCfg;
pub use config::SecurityConfig;
pub use config::ServerConfig;
pub use config::ZenithConfig;
pub use ct_compare::constant_time_all_pass;
pub use ct_compare::constant_time_contains;
pub use ct_compare::constant_time_contains_case_insensitive;
pub use ct_compare::constant_time_eq;
pub use ct_compare::constant_time_eq_ascii_lower;
pub use ct_compare::constant_time_eq_case_insensitive;
pub use ct_compare::constant_time_eq_u32;
pub use ct_compare::constant_time_eq_u64;
pub use ct_compare::constant_time_eq_u128;
pub use ct_compare::constant_time_starts_with;
pub use error::CoreError;
pub use error::CoreResult;
pub use frame::FrameId;
pub use frame::FramePool;
pub use frame::FrameState;
pub use frame::FrameInfo;
pub use huffman::HuffmanDecodeError;
pub use huffman::HuffmanDecoder;
pub use huffman::HuffmanEncoder;
pub use huffman::HUFFMAN_TABLE;
pub use ledger::ResourceLedger;
pub use ledger::LedgerQuota;
pub use ledger::LedgerType;
pub use ledger::ResourceType;
pub use random::pseudo_random_bounded;
pub use random::pseudo_random_u64;
pub use random::random_u64;
pub use random::try_fill_random;
pub use random::try_random_u64;
pub use random::Splitmix64;
pub use varint::encode_varint;
pub use varint::encode_varint_buf;
pub use varint::parse_varint;
pub use varint::MAX_VARINT_SIZE;
pub use varint::MAX_VARINT_VALUE;
pub use prefix_int::decode_prefix_integer;
pub use prefix_int::encode_prefix_integer;
pub use sync::lock_recover;
pub use sync::read_recover;
pub use sync::write_recover;
pub use token::FrameToken;

Modules§

backoff
统一指数退避(全 workspace 唯一实现)
config
Zenith 配置系统
ct_compare
恒定时间比较工具
error
统一错误类型与错误处理规范
frame
Frame 池管理模块
huffman
HPACK/QPACK Huffman 编解码器 (RFC 7541 Appendix B)
ledger
分层资源账本模块
net
网络协议常量(单一权威来源)
prefix_int
RFC 7541 §5.1 前缀整数编解码(HPACK / QPACK 共享唯一实现)
random
统一随机源(全 workspace 唯一入口)
sync
同步原语辅助(全 workspace 唯一实现)
token
所有权令牌模块
varint
QUIC 变长整数编码(RFC 9000 §16 唯一实现)

Functions§

current_time_ms
获取当前 Unix 时间戳(毫秒)
hex_encode
字节切片 → 小写 hex 字符串(无依赖,逐字节 {:02x}