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

Function _GraphContext_UpdateVersion

src/graph/graphcontext.c:303–320  ·  view source on GitHub ↗

Update graph context version

Source from the content-addressed store, hash-verified

301
302// Update graph context version
303static 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

Callers 2

GraphContext_AddSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected