MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / ApplyDeleteEdge

Function ApplyDeleteEdge

src/effects/effects_apply.c:435–483  ·  view source on GitHub ↗

process DeleteNode effect

Source from the content-addressed store, hash-verified

433
434// process DeleteNode effect
435static void ApplyDeleteEdge
436(
437 FILE *stream, // effects stream
438 GraphContext *gc // graph to operate on
439) {
440 //--------------------------------------------------------------------------
441 // effect format:
442 // edge ID
443 // relation ID
444 // src ID
445 // dest ID
446 //--------------------------------------------------------------------------
447
448 Edge e; // edge to delete
449
450 EntityID id = INVALID_ENTITY_ID; // edge ID
451 int r_id = GRAPH_UNKNOWN_RELATION; // edge rel-type
452 NodeID s_id = INVALID_ENTITY_ID; // edge src node ID
453 NodeID t_id = INVALID_ENTITY_ID; // edge dest node ID
454
455 int res;
456 UNUSED(res);
457
458 Graph *g = gc->g; // graph to delete edge from
459
460 // read edge ID
461 fread_assert(&id, sizeof(EntityID), stream);
462
463 // read relation ID
464 fread_assert(&r_id, sizeof(RelationID), stream);
465
466 // read src node ID
467 fread_assert(&s_id, sizeof(EntityID), stream);
468
469 // read dest node ID
470 fread_assert(&t_id, sizeof(EntityID), stream);
471
472 // get edge from the graph
473 res = Graph_GetEdge(g, id, (Edge*)&e);
474 ASSERT(res != 0);
475
476 // set edge relation, src and destination node
477 Edge_SetSrcNodeID(&e, s_id);
478 Edge_SetDestNodeID(&e, t_id);
479 Edge_SetRelationID(&e, r_id);
480
481 // delete edge
482 DeleteEdges(gc, &e, 1, false);
483}
484
485// returns false in case of effect encode/decode version mismatch
486static bool ValidateVersion

Callers 1

Effects_ApplyFunction · 0.85

Calls 5

Graph_GetEdgeFunction · 0.85
Edge_SetSrcNodeIDFunction · 0.85
Edge_SetDestNodeIDFunction · 0.85
Edge_SetRelationIDFunction · 0.85
DeleteEdgesFunction · 0.85

Tested by

no test coverage detected