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

Function EffectsBuffer_AddCreateNodeEffect

src/effects/effects.c:326–371  ·  view source on GitHub ↗

add a node creation effect to buffer

Source from the content-addressed store, hash-verified

324
325// add a node creation effect to buffer
326void EffectsBuffer_AddCreateNodeEffect
327(
328 EffectsBuffer *buff, // effect buffer
329 const Node *n, // node created
330 const LabelID *labels, // node labels
331 ushort label_count // number of labels
332) {
333 //--------------------------------------------------------------------------
334 // effect format:
335 // effect type
336 // label count
337 // labels
338 // attribute count
339 // attributes (id,value) pair
340 //--------------------------------------------------------------------------
341
342 ResultSetStatistics *stats = QueryCtx_GetResultSetStatistics();
343 stats->nodes_created++;
344 stats->properties_set += AttributeSet_Count(*n->attributes);
345
346 EffectType t = EFFECT_CREATE_NODE;
347 EffectsBuffer_WriteBytes(&t, sizeof(t), buff);
348
349 //--------------------------------------------------------------------------
350 // write label count
351 //--------------------------------------------------------------------------
352
353 EffectsBuffer_WriteBytes(&label_count, sizeof(label_count), buff);
354
355 //--------------------------------------------------------------------------
356 // write labels
357 //--------------------------------------------------------------------------
358
359 if(label_count > 0) {
360 EffectsBuffer_WriteBytes(labels, sizeof(LabelID) * label_count, buff);
361 }
362
363 //--------------------------------------------------------------------------
364 // write attribute set
365 //--------------------------------------------------------------------------
366
367 const AttributeSet attrs = GraphEntity_GetAttributes((const GraphEntity*)n);
368 EffectsBuffer_WriteAttributeSet(attrs, buff);
369
370 EffectsBuffer_IncEffectCount(buff);
371}
372
373// add a edge creation effect to buffer
374void EffectsBuffer_AddCreateEdgeEffect

Callers 1

CreateNodeFunction · 0.85

Tested by

no test coverage detected