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

Function _IncrementalHashEntity

src/execution_plan/ops/op_merge_create.c:19–50  ·  view source on GitHub ↗

convert a graph entity's components into an identifying hash code

Source from the content-addressed store, hash-verified

17
18// convert a graph entity's components into an identifying hash code
19static void _IncrementalHashEntity(XXH64_state_t *state, const char **labels,
20 uint label_count, AttributeSet *set) {
21 AttributeSet _set = *set;
22
23 // update hash with label if one is provided
24 XXH_errorcode res;
25 UNUSED(res);
26
27 for(uint i = 0; i < label_count; i++) {
28 res = XXH64_update(state, labels[i], strlen(labels[i]));
29 ASSERT(res != XXH_ERROR);
30 }
31
32 if(_set) {
33 // update hash with attribute count
34 res = XXH64_update(state, &_set->attr_count, sizeof(_set->attr_count));
35 ASSERT(res != XXH_ERROR);
36
37 for (uint16_t i = 0; i < _set->attr_count; ++i) {
38 Attribute *a = _set->attributes + i;
39
40 // update hash with attribute ID
41 res = XXH64_update(state, &a->id, sizeof(a->id));
42 ASSERT(res != XXH_ERROR);
43
44 // update hash with the hashval of the associated SIValue
45 XXH64_hash_t value_hash = SIValue_HashCode(a->value);
46 res = XXH64_update(state, &value_hash, sizeof(value_hash));
47 ASSERT(res != XXH_ERROR);
48 }
49 }
50}
51
52// revert the most recent set of buffered creations and free any allocations.
53static void _RollbackPendingCreations

Callers 1

_CreateEntitiesFunction · 0.85

Calls 1

SIValue_HashCodeFunction · 0.85

Tested by

no test coverage detected