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

Function DeleteNodes

src/graph/graph_hub.c:157–186  ·  view source on GitHub ↗

delete a node remove the node from the relevant indexes add node deletion operation to undo-log return 1 on success, 0 otherwise

Source from the content-addressed store, hash-verified

155// add node deletion operation to undo-log
156// return 1 on success, 0 otherwise
157void DeleteNodes
158(
159 GraphContext *gc,
160 Node *nodes,
161 uint n,
162 bool log
163) {
164 ASSERT(gc != NULL);
165 ASSERT(nodes != NULL);
166
167 bool has_indices = GraphContext_HasIndices(gc);
168
169 UndoLog undo_log = (log) ? QueryCtx_GetUndoLog() : NULL;
170 EffectsBuffer *eb = (log) ? QueryCtx_GetEffectsBuffer() : NULL;
171 for(uint i = 0; i < n; i++) {
172 Node *n = nodes + i;
173
174 if(log) {
175 // add node deletion operation to undo log
176 UndoLog_DeleteNode(undo_log, n);
177 EffectsBuffer_AddDeleteNodeEffect(eb, n);
178 }
179
180 if(has_indices) {
181 _DeleteNodeFromIndices(gc, n);
182 }
183 }
184
185 Graph_DeleteNodes(gc->g, nodes, n);
186}
187
188void DeleteEdges
189(

Callers 2

ApplyDeleteNodeFunction · 0.85
_DeleteEntitiesFunction · 0.85

Calls 7

GraphContext_HasIndicesFunction · 0.85
QueryCtx_GetUndoLogFunction · 0.85
UndoLog_DeleteNodeFunction · 0.85
_DeleteNodeFromIndicesFunction · 0.85
Graph_DeleteNodesFunction · 0.85

Tested by

no test coverage detected