Skip to main content

NodeConfig

Struct NodeConfig 

Source
pub struct NodeConfig {
Show 14 fields pub name: String, pub kernel: String, pub input_ports: Vec<String>, pub output_ports: Vec<String>, pub executor: String, pub max_in_flight: usize, pub options: Value, pub input_policy: InputPolicyConfig, pub input_queues: InputQueuesConfig, pub type: String, pub back_edges: Vec<String>, pub on_error: String, pub rate: f64, pub route: Option<RouteConfig>, /* private fields */
}

Fields§

§name: String§kernel: String

算子名。与 type 二选一:算子节点填 kernel,子图实例节点填 type(见 expand)。

§input_ports: Vec<String>§output_ports: Vec<String>§executor: String

本节点跑在哪个执行器上(按 executors[].name 引用)。空 = 默认执行器。

§max_in_flight: usize

该节点允许的并发 process 数。0/1 = 串行(默认);>1 要求所属执行器 有多于一个线程(委托执行器 0 线程、单线程池并行度恒为 1,均会在建图期报错)。

§options: Value§input_policy: InputPolicyConfig§input_queues: InputQueuesConfig

正向输入口的无损包数容量。

内部生产者遇满不会阻塞 worker,而是保留本次 staging、释放执行线程, 等下游弹包后协作式恢复刷新。packets 为节点默认值,ports 按端口覆盖; 与有损 fixed_size 互斥。

§type: String

子图名(ADR #27):非空 = 本节点是该子图的实例,建图期展开内联;与 kernel 二选一。

§back_edges: Vec<String>

反馈环(back-edge):本节点哪些输入口名是「最新值反馈寄存器」—— 容量 1、留最新 反馈值、消费一次,且不参与就绪 / 终止 / 时间戳对齐(见 docs/design.md)。 用它才能让边成环:未被 back_edge 打断的拓扑环仍在建图期报错。

§on_error: String

本节点算子失败时怎么办:"abort"(默认)或 "skip"。

  • abort —— 记录首个错误、终止全图(历史行为)。
  • skip —— 丢掉出错的那一个包、推进下游时间戳边界、计数并打 WARN,然后继续跑。 用于长跑实时管线:一帧坏数据不该杀掉整条流水线。

只有这两个值(没有单独的 log:skip 本身一定会计数并打日志 —— 本项目不接受静默的有损行为,见 §7.6)。

§rate: f64

**源节点(0 输入)**的产出速率上限,单位 Hz(每秒次数)。0(默认)= 不限速。

声明式定速:设了它,引擎保证每两次 process 之间至少间隔 1/rate 秒 —— 算子不必自己写 sleep。用于「30fps 合成源」这类场景,也顺带避免非自定速的源 灌爆下游(内部边不背压,见 §7.5)。

只对源节点有意义;非源节点由上游数据驱动,设了会在建图期报错。 实现:本次调用完成后进入执行器延迟队列,不占用等待中的 worker。

§route: Option<RouteConfig>

Conditional output routing configuration. Route fields are flattened so YAML can declare type: route, mode, routes, and unmatched directly.

Trait Implementations§

Source§

impl Clone for NodeConfig

Source§

fn clone(&self) -> NodeConfig

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 NodeConfig

Source§

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

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

impl Default for NodeConfig

与 serde 默认逐字段对齐(照 InputPolicyConfig 的先例手写、不 derive): input_policy 的默认 type 是 "sync" 而非空串,derive 会给错。 有了它,以后给 NodeConfig 加字段不会再打断仓库内的结构体字面量。

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for NodeConfig

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.