pub struct GraphConfig {Show 13 fields
pub executors: Vec<ExecutorConfig>,
pub nodes: Vec<NodeConfig>,
pub include: Vec<String>,
pub subgraphs: BTreeMap<String, SubgraphConfig>,
pub input_ports: Vec<String>,
pub output_ports: Vec<String>,
pub max_queue_size: usize,
pub max_queued_packets: usize,
pub watchdog_ms: u64,
pub buffer_pool_max_bytes: usize,
pub stats: Option<StatsLevel>,
pub stats_timing: Option<bool>,
pub trace_capacity: usize,
}Fields§
§executors: Vec<ExecutorConfig>§nodes: Vec<NodeConfig>§include: Vec<String>其它 YAML 文件路径(相对本文件目录),引入其 subgraphs 定义。仅 from_yaml_file 生效。
subgraphs: BTreeMap<String, SubgraphConfig>可复用子图库:名字 → 一张小图;节点用 type: <名字> 实例化,建图期展开内联。
input_ports: Vec<String>图输入口(外部送包的入口)
output_ports: Vec<String>图输出口(poller / observer 挂载点)
max_queue_size: usize图输入口队列上限,也用作内部边的软水位
max_queued_packets: usize全局水位:全图在途包数上限(0 = 不限)
watchdog_ms: u64单次算子回调超过该时长即打 WARN(0 = 关闭)
buffer_pool_max_bytes: usize算子内 buffer 分配池上限(字节, 0 = 关闭)
stats: Option<StatsLevel>运行时统计级别。省略时为 basic。
full 才记录每次回调耗时、百分位、CoW 与执行器耗时;off 进一步关闭低成本
吞吐和高水位计数。watchdog_ms > 0 时会强制提升为 full。
stats_timing: Option<bool>旧版兼容字段:true 等价于 stats: full,false 等价于 stats: basic。
不得与 stats 同时出现。
trace_capacity: usize逐次调用 trace 的有界环容量(条数,0 = 关闭)。
大于 0 时,每次 Open/Process/Close 回调记一条 span 进有界环(满了丢最旧),可经
to_chrome_trace() 导出成 chrome://tracing / perfetto 可读的 JSON。开启会强制
统计提升为 full(需要每次回调计时),故不要在稳态生产中长开。
单位是条而非字节:每条 span 40 字节,故 4096 条 ≈ 160 KB、100 万条 ≈ 40 MB。 引擎不设上限 —— 环占多少内存由你这个数字直接决定,填之前先乘一下。
Implementations§
Source§impl GraphConfig
impl GraphConfig
Sourcepub fn preflight_from_yaml(text: &str) -> Result<Self>
pub fn preflight_from_yaml(text: &str) -> Result<Self>
Parse, resolve includes, expand subgraphs, and validate configuration-only rules.
This entry point deliberately does not access the kernel registry or create executors. Use it for deployment-time checks where the host may not have linked its kernels yet.
Sourcepub fn preflight_from_yaml_file(path: &str) -> Result<Self>
pub fn preflight_from_yaml_file(path: &str) -> Result<Self>
File equivalent of Self::preflight_from_yaml.
pub fn effective_stats_level(&self) -> StatsLevel
Sourcepub fn from_yaml(text: &str) -> Result<Self>
pub fn from_yaml(text: &str) -> Result<Self>
从 YAML 文本建图配置:解析 → 展开子图 → 校验,返回展平(无 type: 节点)的配置。
文本入口不支持 include(相对路径无从解析);需要 include 请用 GraphConfig::from_yaml_file。
Sourcepub fn from_yaml_file(path: &str) -> Result<Self>
pub fn from_yaml_file(path: &str) -> Result<Self>
从 YAML 文件建图配置:读文件 → 按本文件目录递归解析 + 合并 include 的子图
→ 展开子图 → 校验。返回展平的配置。
Trait Implementations§
Source§impl Clone for GraphConfig
impl Clone for GraphConfig
Source§fn clone(&self) -> GraphConfig
fn clone(&self) -> GraphConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphConfig
impl Debug for GraphConfig
Source§impl Default for GraphConfig
必须与上面的 serde 默认值保持一致 —— 否则「YAML 省略字段」与 Rust
..Default::default() 两条路会得到不同行为,故手写而不 derive。
impl Default for GraphConfig
必须与上面的 serde 默认值保持一致 —— 否则「YAML 省略字段」与 Rust
..Default::default() 两条路会得到不同行为,故手写而不 derive。