link
Assert a typed memory-to-memory edge, alongside the ones the write pipeline infers.
async fn link(&self, input: &LinkInput) -> Result<LinkResult, BrainHttpError>async fn link(&self, request: &LinkRequest) -> Result<LinkResponse>Parameters
ParameterTypeRequired
sourcestring (wire: 64-bit integer)requiredThe memory the edge leaves.
targetstring (wire: 64-bit integer)requiredThe memory it points at.
kindEdgeKindrequiredOne of caused, followed_by, derived_from, similar_to, contradicts, supports, references, part_of. Anything else is BadEdgeKind. On the wire these are integer discriminants, not lowercase strings.
weightfloatoptionalEdge strength. Defaults server-side.
Returns
FieldTypePresence
source / target / kind / weight—alwaysEchoed back as stored.
created_at_unix_nanos64-bit integeralwaysWhen the edge was written.
already_existedbooleanalwaystrue when the edge was already there. This is what makes link idempotent — a repeat is a success, not a duplicate.
Example
brain.link(&LinkInput {
source: outage_id.clone(),
target: rollback_id.clone(),
kind: EdgeKind::Caused,
weight: Some(0.9),
}).await?;See also
Was this page helpful?