MCPcopy Create free account
hub / github.com/documentdb/documentdb / PopulateCurrentOpOptions

Function PopulateCurrentOpOptions

pg_documentdb/src/commands/current_op.c:305–342  ·  view source on GitHub ↗

* Populates the CurrentOp options based on the command spec. */

Source from the content-addressed store, hash-verified

303 * Populates the CurrentOp options based on the command spec.
304 */
305static void
306PopulateCurrentOpOptions(pgbson *spec, CurrentOpOptions *options)
307{
308 bson_iter_t currentOpIter;
309 PgbsonInitIterator(spec, &currentOpIter);
310 while (bson_iter_next(&currentOpIter))
311 {
312 const char *path = bson_iter_key(&currentOpIter);
313 const bson_value_t *value = bson_iter_value(&currentOpIter);
314 EnsureTopLevelFieldIsBooleanLike(path, &currentOpIter);
315
316 bool valueBool = BsonValueAsBool(value);
317 if (strcmp(path, "allUsers") == 0)
318 {
319 options->allUsers = valueBool;
320 }
321 else if (strcmp(path, "idleConnections") == 0)
322 {
323 options->idleConnections = valueBool;
324 }
325 else if (strcmp(path, "idleCursors") == 0)
326 {
327 options->idleCursors = valueBool;
328 }
329 else if (strcmp(path, "idleSessions") == 0)
330 {
331 options->idleSessions = valueBool;
332 }
333 else if (strcmp(path, "localOps") == 0)
334 {
335 options->localOps = valueBool;
336 }
337 else if (strcmp(path, "backtrace") == 0)
338 {
339 /* ignore*/
340 }
341 }
342}
343
344
345/*

Callers 2

CurrentOpAggregateCoreFunction · 0.85
CurrentOpWorkerCoreFunction · 0.85

Calls 3

PgbsonInitIteratorFunction · 0.85
BsonValueAsBoolFunction · 0.85

Tested by

no test coverage detected