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

Function QueriesLog_New

src/queries_log/queries_log.c:35–53  ·  view source on GitHub ↗

create a new queries log structure

Source from the content-addressed store, hash-verified

33
34// create a new queries log structure
35QueriesLog QueriesLog_New(void) {
36 QueriesLog log = rm_calloc(1, sizeof(struct _QueriesLog));
37
38 // initialize read/write lock
39 int res = pthread_rwlock_init(&log->rwlock, NULL);
40 ASSERT(res == 0);
41
42 // create circular buffer
43 // read buffer capacity from configuration
44 uint32_t cap;
45 bool get = Config_Option_get(Config_CMD_INFO_MAX_QUERY_COUNT, &cap);
46 ASSERT(get == true);
47
48 size_t item_size = sizeof(LoggedQuery);
49 log->swap = CircularBuffer_New(item_size, cap);
50 log->queries = CircularBuffer_New(item_size, cap);
51
52 return log;
53}
54
55// add query to buffer
56void QueriesLog_AddQuery

Callers 3

GraphContext_NewFunction · 0.85
_fake_graph_contextFunction · 0.85
_fake_graph_contextFunction · 0.85

Calls 3

rm_callocFunction · 0.85
Config_Option_getFunction · 0.85
CircularBuffer_NewFunction · 0.85

Tested by 2

_fake_graph_contextFunction · 0.68
_fake_graph_contextFunction · 0.68