convert a graph entity's components into an identifying hash code
| 17 | |
| 18 | // convert a graph entity's components into an identifying hash code |
| 19 | static 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. |
| 53 | static void _RollbackPendingCreations |
no test coverage detected