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

Function GraphContext_UnsafeGetGraphContext

src/graph/graphcontext.c:782–800  ·  view source on GitHub ↗

retrive GraphContext from the global array graph isn't registered, NULL is returned graph's references count isn't increased! this is OK as long as only a single thread has access to the graph

Source from the content-addressed store, hash-verified

780// graph's references count isn't increased!
781// this is OK as long as only a single thread has access to the graph
782GraphContext *GraphContext_UnsafeGetGraphContext
783(
784 const char *graph_name
785) {
786 KeySpaceGraphIterator it;
787 Globals_ScanGraphs(&it);
788
789 GraphContext *gc = NULL;
790
791 while((gc = GraphIterator_Next(&it)) != NULL) {
792 bool match = (strcmp(gc->graph_name, graph_name) == 0);
793 GraphContext_DecreaseRefCount(gc);
794 if(match == true) {
795 break;
796 }
797 }
798
799 return gc;
800}
801
802//------------------------------------------------------------------------------
803// Slowlog API

Callers 6

_GetOrCreateGraphContextFunction · 0.85
_GetOrCreateGraphContextFunction · 0.85
_GetOrCreateGraphContextFunction · 0.85
_GetOrCreateGraphContextFunction · 0.85
_GetOrCreateGraphContextFunction · 0.85
_GetOrCreateGraphContextFunction · 0.85

Calls 3

Globals_ScanGraphsFunction · 0.85
GraphIterator_NextFunction · 0.85

Tested by

no test coverage detected