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

Function _GraphContext_RequiredMetaKeys

src/module_event_handlers.c:99–113  ·  view source on GitHub ↗

Calculate how many virtual keys are needed to represent the graph.

Source from the content-addressed store, hash-verified

97
98// Calculate how many virtual keys are needed to represent the graph.
99static uint64_t _GraphContext_RequiredMetaKeys(const GraphContext *gc) {
100 uint64_t vkey_entity_count;
101 Config_Option_get(Config_VKEY_MAX_ENTITY_COUNT, &vkey_entity_count);
102 gc->encoding_context->vkey_entity_count = vkey_entity_count;
103
104 uint64_t entities_count = Graph_NodeCount(gc->g) + Graph_EdgeCount(gc->g) +
105 Graph_DeletedNodeCount(gc->g) + Graph_DeletedEdgeCount(gc->g);
106
107 if(entities_count == 0) return 0;
108
109 // calculate the required keys
110 // substruct one since there is also the graph context key
111 uint64_t key_count = ceil((double)entities_count / vkey_entity_count) - 1;
112 return MAX(key_count, 0);
113}
114
115static void _CreateGraphMetaKeys
116(

Callers 1

_CreateGraphMetaKeysFunction · 0.85

Calls 5

Config_Option_getFunction · 0.85
Graph_NodeCountFunction · 0.85
Graph_EdgeCountFunction · 0.85
Graph_DeletedNodeCountFunction · 0.85
Graph_DeletedEdgeCountFunction · 0.85

Tested by

no test coverage detected