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

Function Globals_RemoveGraph

src/globals.c:110–138  ·  view source on GitHub ↗

remove graph from global tracker

Source from the content-addressed store, hash-verified

108
109// remove graph from global tracker
110void Globals_RemoveGraph
111(
112 GraphContext *gc // graph to remove
113) {
114 ASSERT(gc != NULL);
115
116 uint64_t i = 0;
117 uint64_t n = array_len(_globals.graphs_in_keyspace);
118 if(n == 0) return;
119
120 // acuire write lock
121 pthread_rwlock_wrlock(&_globals.lock);
122
123 // search for graph
124 for(; i < n; i++) {
125 if(_globals.graphs_in_keyspace[i] == gc) {
126 break;
127 }
128 }
129
130 // graph must be found
131 ASSERT(i != n);
132
133 // graph located, remove it
134 array_del_fast(_globals.graphs_in_keyspace, i);
135
136 // release lock
137 pthread_rwlock_unlock(&_globals.lock);
138}
139
140// remove a graph by its name
141void Globals_RemoveGraphByName

Callers 1

_GraphContextType_FreeFunction · 0.85

Calls 1

array_lenFunction · 0.85

Tested by

no test coverage detected