Skip to main content

GraphConfig

Struct GraphConfig 

Source
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

Source

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.

Source

pub fn preflight_from_yaml_file(path: &str) -> Result<Self>

File equivalent of Self::preflight_from_yaml.

Source

pub fn effective_stats_level(&self) -> StatsLevel

Source

pub fn parse(text: &str) -> Result<Self>

只做 serde 解析:不校验、不展开、不解析 include。管线内部用。

Source

pub fn from_yaml(text: &str) -> Result<Self>

从 YAML 文本建图配置:解析 → 展开子图 → 校验,返回展平(无 type: 节点)的配置。 文本入口不支持 include(相对路径无从解析);需要 include 请用 GraphConfig::from_yaml_file。

Source

pub fn from_yaml_file(path: &str) -> Result<Self>

从 YAML 文件建图配置:读文件 → 按本文件目录递归解析 + 合并 include 的子图 → 展开子图 → 校验。返回展平的配置。

Trait Implementations§

Source§

impl Clone for GraphConfig

Source§

fn clone(&self) -> GraphConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GraphConfig

必须与上面的 serde 默认值保持一致 —— 否则「YAML 省略字段」与 Rust ..Default::default() 两条路会得到不同行为,故手写而不 derive。

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GraphConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.