Expand description
The C ABI layer: the implementation behind include/lmflow/flow.h.
Conventions:
- Every exported function is wrapped in
catch_unwind— letting a Rust panic cross an FFI boundary is undefined behaviour. - On failure the thread-local
lmflow_last_erroris set, so the caller can obtain a readable reason. - Structs that cross the boundary are
#[repr(C)], with the layout pinned from both sides bytests/abi_layout.rsandcpp/abi_assert.cc. - Every exported function null-checks its pointers and returns an error code or a default value rather than crashing.
On missing_safety_doc: the functions here are consumed by C callers, whose safety
contract — pointer validity, ownership transfer, lifetimes — is authoritatively defined by the
comments in include/lmflow/flow.h, which is the documentation C and C++ users actually read.
Restating it here in Rust # Safety form would only create two descriptions that drift apart,
so the lint is waived for the whole module.
Structs§
- Graph
Slot lmflow_graph_new先返回一个空槽,init_from_yaml才真正建图。- Input
Handle - The object behind a graph input-port handle; its lifetime follows the graph.
- Kernel
Runner Handle - LMFlow
Buffer - LMFlow
Context - LMFlow
Contract - LMFlow
Graph - LMFlow
Input - LMFlow
Input Queue Stats - LMFlow
Kernel Runner - LMFlow
KernelV Table - LMFlow
Node Stats - LMFlow
Packet - LMFlow
Poller
Constants§
- ABI_
VERSION - BUF_
FLAG_ READONLY - DEVICE_
CPU - INVALID_
ID - LMFLOW_
DOT_ COMPACT - LMFLOW_
DOT_ DIAGNOSTICS - LMFLOW_
DOT_ TOPOLOGY - LMFLOW_
POLLER_ BLOCK - LMFLOW_
POLLER_ DROP_ NEWEST - LMFLOW_
POLLER_ DROP_ OLDEST - LMFLOW_
POLLER_ LATEST
Functions§
- borrow_
packet - 借用形态:不增加引用计数,调用方不得 drop。
- lmflow_
abi_ version - lmflow_
contract_ ⚠input_ id - lmflow_
contract_ ⚠input_ index - lmflow_
contract_ ⚠input_ name - lmflow_
contract_ ⚠input_ set_ any - lmflow_
contract_ ⚠input_ set_ type - lmflow_
contract_ ⚠num_ inputs - lmflow_
contract_ ⚠num_ outputs - lmflow_
contract_ ⚠output_ id - lmflow_
contract_ ⚠output_ index - lmflow_
contract_ ⚠output_ name - lmflow_
contract_ ⚠output_ set_ any - lmflow_
contract_ ⚠output_ set_ type - lmflow_
contract_ ⚠require_ side_ packet - lmflow_
contract_ ⚠set_ error - lmflow_
ctx_ ⚠close_ reason - lmflow_
ctx_ ⚠counter_ add - lmflow_
ctx_ ⚠emit - lmflow_
ctx_ ⚠forward - lmflow_
ctx_ ⚠has_ option - lmflow_
ctx_ ⚠has_ side_ packet - lmflow_
ctx_ ⚠input - lmflow_
ctx_ ⚠input_ at - lmflow_
ctx_ ⚠input_ count - lmflow_
ctx_ ⚠input_ id - lmflow_
ctx_ ⚠input_ index - lmflow_
ctx_ ⚠input_ is_ done - lmflow_
ctx_ ⚠input_ is_ empty - lmflow_
ctx_ ⚠input_ name - lmflow_
ctx_ ⚠input_ payload - lmflow_
ctx_ ⚠input_ timestamp - lmflow_
ctx_ ⚠kernel_ name - lmflow_
ctx_ ⚠log - lmflow_
ctx_ ⚠node_ name - lmflow_
ctx_ ⚠num_ inputs - lmflow_
ctx_ ⚠num_ outputs - lmflow_
ctx_ ⚠option_ bool - lmflow_
ctx_ ⚠option_ count - lmflow_
ctx_ ⚠option_ f64 - lmflow_
ctx_ ⚠option_ f64_ array - lmflow_
ctx_ ⚠option_ i64 - lmflow_
ctx_ ⚠option_ i64_ array - lmflow_
ctx_ ⚠option_ str - lmflow_
ctx_ ⚠option_ str_ array - lmflow_
ctx_ ⚠options_ json - lmflow_
ctx_ ⚠output_ id - lmflow_
ctx_ ⚠output_ index - lmflow_
ctx_ ⚠output_ name - lmflow_
ctx_ ⚠require_ option_ bool - lmflow_
ctx_ ⚠require_ option_ f64 - lmflow_
ctx_ ⚠require_ option_ i64 - lmflow_
ctx_ ⚠require_ option_ str - lmflow_
ctx_ ⚠set_ error - lmflow_
ctx_ ⚠set_ next_ ts_ bound - lmflow_
ctx_ ⚠side_ packet - lmflow_
ctx_ ⚠source_ done - lmflow_
ctx_ ⚠source_ yield - lmflow_
ctx_ ⚠take_ input - lmflow_
dtype_ size - lmflow_
graph_ ⚠add_ packet - lmflow_
graph_ ⚠add_ poller - lmflow_
graph_ ⚠add_ poller_ bounded - lmflow_
graph_ ⚠add_ poller_ ex - lmflow_
graph_ ⚠cancel - lmflow_
graph_ ⚠close_ all_ inputs - lmflow_
graph_ ⚠close_ input - lmflow_
graph_ ⚠counter_ count - lmflow_
graph_ ⚠counter_ name - lmflow_
graph_ ⚠counter_ value - lmflow_
graph_ ⚠dropped_ count - lmflow_
graph_ ⚠dump - lmflow_
graph_ ⚠free lmflow_graph_new先返回一个空槽,init_from_yaml才真正建图。- lmflow_
graph_ ⚠init_ from_ yaml - lmflow_
graph_ ⚠init_ from_ yaml_ file - lmflow_
graph_ ⚠input - lmflow_
graph_ ⚠input_ port_ name - lmflow_
graph_ ⚠input_ queue_ stats - lmflow_
graph_ ⚠last_ error - lmflow_
graph_ new - lmflow_
graph_ ⚠node_ input_ port_ name - lmflow_
graph_ ⚠node_ name - lmflow_
graph_ ⚠node_ num_ input_ ports - lmflow_
graph_ ⚠node_ stats - lmflow_
graph_ ⚠num_ input_ ports - lmflow_
graph_ ⚠num_ nodes - lmflow_
graph_ ⚠num_ output_ ports - lmflow_
graph_ ⚠observe - lmflow_
graph_ ⚠observe_ ex - lmflow_
graph_ ⚠output_ port_ name - lmflow_
graph_ ⚠pause - lmflow_
graph_ ⚠pump_ step - lmflow_
graph_ ⚠pump_ steps - lmflow_
graph_ ⚠queue_ depth - lmflow_
graph_ ⚠reset - 复位已结束的图,使其可再次
start,保留已 open 的算子实例(见 flow.h)。 图须处于 Terminated 且静止,否则返回 LMFLOW_ERR_STATE。 - lmflow_
graph_ ⚠resume - lmflow_
graph_ ⚠set_ side_ packet - lmflow_
graph_ ⚠set_ wakeup_ callback - lmflow_
graph_ ⚠start - lmflow_
graph_ ⚠state - lmflow_
graph_ ⚠to_ chrome_ trace - 导出当前 trace 环内容为 Chrome Trace Event Format 的 JSON(chrome://tracing / perfetto
可直接打开)。需在建图时设
trace_capacity > 0;未开启时返回合法的空 trace。返回值同dump:线程局部缓冲,下次在本线程调用即失效,调用方不得 free(需要就先拷走)。 - lmflow_
graph_ ⚠to_ dot_ view - 显式选择 Graphviz DOT 的详细程度。返回值同
dump:线程局部缓冲,调用方不得 free。 - lmflow_
graph_ ⚠total_ queued - lmflow_
graph_ ⚠total_ queued_ bytes - lmflow_
graph_ ⚠wait_ done - lmflow_
graph_ ⚠wait_ done_ timeout - lmflow_
graph_ ⚠wait_ until_ idle - lmflow_
graph_ ⚠wait_ until_ idle_ timeout - lmflow_
input_ ⚠close - lmflow_
input_ ⚠free - lmflow_
input_ ⚠send - lmflow_
input_ ⚠try_ send - lmflow_
kernel_ ⚠runner_ add_ input - lmflow_
kernel_ ⚠runner_ close - lmflow_
kernel_ ⚠runner_ free - lmflow_
kernel_ ⚠runner_ new - lmflow_
kernel_ ⚠runner_ process - lmflow_
kernel_ ⚠runner_ set_ options_ json - lmflow_
kernel_ ⚠runner_ set_ side_ packet - lmflow_
kernel_ ⚠runner_ start - lmflow_
kernel_ ⚠runner_ try_ next - lmflow_
last_ error - lmflow_
packet_ ⚠adopt_ buffer - lmflow_
packet_ ⚠as_ bool - lmflow_
packet_ ⚠as_ buffer - lmflow_
packet_ ⚠as_ bytes - lmflow_
packet_ ⚠as_ f64 - lmflow_
packet_ ⚠as_ i64 - lmflow_
packet_ ⚠as_ str - lmflow_
packet_ ⚠clone - lmflow_
packet_ ⚠debug_ string - lmflow_
packet_ ⚠drop - lmflow_
packet_ from_ bool - lmflow_
packet_ ⚠from_ buffer - lmflow_
packet_ ⚠from_ bytes - lmflow_
packet_ from_ f64 - lmflow_
packet_ from_ i64 - lmflow_
packet_ ⚠from_ str - lmflow_
packet_ ⚠has_ metadata - lmflow_
packet_ ⚠make_ mutable_ buffer - lmflow_
packet_ ⚠make_ mutable_ bytes - lmflow_
packet_ ⚠metadata_ bool - lmflow_
packet_ ⚠metadata_ count - lmflow_
packet_ ⚠metadata_ f64 - lmflow_
packet_ ⚠metadata_ i64 - lmflow_
packet_ ⚠metadata_ key_ at - lmflow_
packet_ ⚠metadata_ str - lmflow_
packet_ ⚠new_ buffer - lmflow_
packet_ ⚠new_ buffer_ uninit - lmflow_
packet_ ⚠remove_ metadata - lmflow_
packet_ ⚠set_ metadata_ bool - lmflow_
packet_ ⚠set_ metadata_ f64 - lmflow_
packet_ ⚠set_ metadata_ i64 - lmflow_
packet_ ⚠set_ metadata_ str - lmflow_
poller_ ⚠dropped_ count - lmflow_
poller_ ⚠free - lmflow_
poller_ ⚠next_ status - lmflow_
poller_ ⚠next_ timeout - lmflow_
poller_ ⚠try_ next_ status - lmflow_
register_ ⚠kernel - lmflow_
register_ ⚠kernel_ with_ language - lmflow_
register_ ⚠type_ descriptor - lmflow_
set_ log_ callback - lmflow_
type_ align - lmflow_
type_ ⚠id - lmflow_
type_ name - lmflow_
type_ size - own_
packet - 移交形态:把一份引用交给调用方,调用方须 emit/send 或 lmflow_packet_drop。
- take_
packet ⚠ - 接管一个跨界包(消耗调用方的那份所有权)。