Skip to main content

GraphShared

Struct GraphShared 

Source
pub struct GraphShared {
    pub config: GraphConfig,
    pub strings: CStrArena,
    /* private fields */
}

Fields§

§config: GraphConfig§strings: CStrArena

Implementations§

Source§

impl GraphShared

Source

pub fn new(config: GraphConfig) -> Self

Source

pub fn record_error(&self, e: Error)

Source

pub fn reset_run_state(&self)

复位所有运行期状态,供图 reset 重跑用(config 等构建期数据不动)。 record_error 只「首因生效、不覆盖」,没有反向清除路径 —— 这里补上, 否则 reset 后的图会带着上一轮的 error / cancelled 出生(start 立刻被挡回)。

只应在图静止时调用(Terminated + is_idle,见 GraphInner::reset),故用 &self + 内部可变即可,无并发。

Source

pub fn trace_enabled(&self) -> bool

trace 是否开启(config.trace_capacity > 0)。热路径据此决定是否读时钟/记 span。

Source

pub fn record_trace( &self, node: u32, phase: TracePhase, start_us: i64, dur_us: i64, input_ts: i64, )

记一条 trace span(仅在开启时)。node 为节点索引,时间相对图 epoch,单位微秒。

Source

pub fn trace_snapshot(&self) -> Vec<TraceEvent>

当前 trace 环内容的快照(未开启时为空)。

Source

pub fn has_error(&self) -> bool

Source

pub fn first_error(&self) -> Option<Error>

Source

pub fn error_cstr(&self) -> *const c_char

图级错误文本的 C 指针 —— 注意 lmflow_last_error 是线程局部的, 工作线程上算子的失败原因只能通过这里拿到。

Source

pub fn cancel(&self)

Source

pub fn is_cancelled(&self) -> bool

Source

pub fn close_reason(&self) -> i32

算子 close 时应告知的原因,供其决定是否提交结果。

Source

pub fn on_enqueue(&self, bytes: u64)

Source

pub fn on_dequeue(&self, bytes: u64)

Source

pub fn total_queued(&self) -> usize

Source

pub fn total_queued_bytes(&self) -> u64

Source

pub fn over_watermark(&self) -> bool

是否已触及全局水位。超限时把压力转化为图输入口背压(只在入口刹车不会 引入 diamond 死锁,见 docs/design.md §7.5)。

水位是软阈值:读的是 Relaxed 快照,故判定可能滞后一两个包 —— 这正是 「水位」该有的语义,不需要精确的那一瞬间。

Source

pub fn counter_add(&self, name: &str, delta: i64)

Source

pub fn counter_value(&self, name: &str) -> i64

Source

pub fn counter_names(&self) -> Vec<String>

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> 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, 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.