| 16 | static void CreateFree(OpBase *opBase); |
| 17 | |
| 18 | OpBase *NewCreateOp(const ExecutionPlan *plan, NodeCreateCtx *nodes, EdgeCreateCtx *edges) { |
| 19 | OpCreate *op = rm_calloc(1, sizeof(OpCreate)); |
| 20 | op->records = NULL; |
| 21 | NewPendingCreationsContainer(&op->pending, nodes, edges); // Prepare all creation variables. |
| 22 | // Set our Op operations |
| 23 | OpBase_Init((OpBase *)op, OPType_CREATE, "Create", NULL, CreateConsume, |
| 24 | NULL, NULL, CreateClone, CreateFree, true, plan); |
| 25 | |
| 26 | uint node_blueprint_count = array_len(nodes); |
| 27 | uint edge_blueprint_count = array_len(edges); |
| 28 | |
| 29 | // Construct the array of IDs this operation modifies |
| 30 | for(uint i = 0; i < node_blueprint_count; i ++) { |
| 31 | NodeCreateCtx *n = nodes + i; |
| 32 | n->node_idx = OpBase_Modifies((OpBase *)op, n->alias); |
| 33 | } |
| 34 | for(uint i = 0; i < edge_blueprint_count; i ++) { |
| 35 | EdgeCreateCtx *e = edges + i; |
| 36 | e->edge_idx = OpBase_Modifies((OpBase *)op, e->alias); |
| 37 | bool aware; |
| 38 | UNUSED(aware); |
| 39 | aware = OpBase_Aware((OpBase *)op, e->src, &e->src_idx); |
| 40 | ASSERT(aware == true); |
| 41 | aware = OpBase_Aware((OpBase *)op, e->dest, &e->dest_idx); |
| 42 | ASSERT(aware == true); |
| 43 | } |
| 44 | |
| 45 | return (OpBase *)op; |
| 46 | } |
| 47 | |
| 48 | // prepare to create all nodes for the current Record |
| 49 | static void _CreateNodes |
no test coverage detected