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

Function Globals_RemoveGraphByName

src/globals.c:141–167  ·  view source on GitHub ↗

remove a graph by its name

Source from the content-addressed store, hash-verified

139
140// remove a graph by its name
141void Globals_RemoveGraphByName
142(
143 const char *name // graph name to remove
144) {
145 ASSERT(name != NULL);
146
147 // acuire write lock
148 pthread_rwlock_wrlock(&_globals.lock);
149
150 // search for graph
151 uint64_t i = 0;
152 uint64_t n = array_len(_globals.graphs_in_keyspace);
153 for(; i < n; i++) {
154 GraphContext *gc = _globals.graphs_in_keyspace[i];
155 if(strcmp(name, GraphContext_GetName(gc)) == 0) {
156 break;
157 }
158 }
159
160 if(i != n) {
161 // graph located, remove it
162 array_del_fast(_globals.graphs_in_keyspace, i);
163 }
164
165 // release lock
166 pthread_rwlock_unlock(&_globals.lock);
167}
168
169// clear all tracked graphs
170void Globals_ClearGraphs

Callers 1

_GenericKeyspaceHandlerFunction · 0.85

Calls 2

array_lenFunction · 0.85
GraphContext_GetNameFunction · 0.85

Tested by

no test coverage detected