Update graph context version
| 301 | |
| 302 | // Update graph context version |
| 303 | static void _GraphContext_UpdateVersion(GraphContext *gc, const char *str) { |
| 304 | ASSERT(gc != NULL); |
| 305 | ASSERT(str != NULL); |
| 306 | |
| 307 | /* Update graph version by hashing 'str' representing the current |
| 308 | * addition to the graph schema: (Label, Relationship-type, Attribute) |
| 309 | * |
| 310 | * Using the current graph version as a seed, by doing so we avoid |
| 311 | * hashing the entire graph schema on each change, while guaranteeing the |
| 312 | * exact same version across a cluster: same graph version on both |
| 313 | * primary and replica shards. */ |
| 314 | |
| 315 | XXH32_state_t *state = XXH32_createState(); |
| 316 | XXH32_reset(state, gc->version); |
| 317 | XXH32_update(state, str, strlen(str)); |
| 318 | gc->version = XXH32_digest(state); |
| 319 | XXH32_freeState(state); |
| 320 | } |
| 321 | |
| 322 | //------------------------------------------------------------------------------ |
| 323 | // Schema API |
no outgoing calls
no test coverage detected