pub struct GraphShared {
pub config: GraphConfig,
pub strings: CStrArena,
/* private fields */
}Fields§
§config: GraphConfig§strings: CStrArenaImplementations§
pub fn new(config: GraphConfig) -> Self
pub fn record_error(&self, e: Error)
Sourcepub fn reset_run_state(&self)
pub fn reset_run_state(&self)
复位所有运行期状态,供图 reset 重跑用(config 等构建期数据不动)。
record_error 只「首因生效、不覆盖」,没有反向清除路径 —— 这里补上,
否则 reset 后的图会带着上一轮的 error / cancelled 出生(start 立刻被挡回)。
只应在图静止时调用(Terminated + is_idle,见 GraphInner::reset),故用
&self + 内部可变即可,无并发。
Sourcepub fn trace_enabled(&self) -> bool
pub fn trace_enabled(&self) -> bool
trace 是否开启(config.trace_capacity > 0)。热路径据此决定是否读时钟/记 span。
Sourcepub fn record_trace(
&self,
node: u32,
phase: TracePhase,
start_us: i64,
dur_us: i64,
input_ts: i64,
)
pub fn record_trace( &self, node: u32, phase: TracePhase, start_us: i64, dur_us: i64, input_ts: i64, )
记一条 trace span(仅在开启时)。node 为节点索引,时间相对图 epoch,单位微秒。
Sourcepub fn trace_snapshot(&self) -> Vec<TraceEvent>
pub fn trace_snapshot(&self) -> Vec<TraceEvent>
当前 trace 环内容的快照(未开启时为空)。
pub fn has_error(&self) -> bool
pub fn first_error(&self) -> Option<Error>
Sourcepub fn error_cstr(&self) -> *const c_char
pub fn error_cstr(&self) -> *const c_char
图级错误文本的 C 指针 —— 注意 lmflow_last_error 是线程局部的,
工作线程上算子的失败原因只能通过这里拿到。
pub fn cancel(&self)
pub fn is_cancelled(&self) -> bool
Sourcepub fn close_reason(&self) -> i32
pub fn close_reason(&self) -> i32
算子 close 时应告知的原因,供其决定是否提交结果。
pub fn on_enqueue(&self, bytes: u64)
pub fn on_dequeue(&self, bytes: u64)
pub fn total_queued(&self) -> usize
pub fn total_queued_bytes(&self) -> u64
Sourcepub fn over_watermark(&self) -> bool
pub fn over_watermark(&self) -> bool
是否已触及全局水位。超限时把压力转化为图输入口背压(只在入口刹车不会 引入 diamond 死锁,见 docs/design.md §7.5)。
水位是软阈值:读的是 Relaxed 快照,故判定可能滞后一两个包 —— 这正是
「水位」该有的语义,不需要精确的那一瞬间。
pub fn counter_add(&self, name: &str, delta: i64)
pub fn counter_value(&self, name: &str) -> i64
pub fn counter_names(&self) -> Vec<String>
Auto Trait Implementations§
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