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

Function BuildResponseMessage

pg_documentdb/src/commands/db_stats.c:394–414  ·  view source on GitHub ↗

* BuildResponseMessage func builds the pgbson response for the dbStats() command */

Source from the content-addressed store, hash-verified

392 * BuildResponseMessage func builds the pgbson response for the dbStats() command
393 */
394static pgbson *
395BuildResponseMessage(DbStatsResult *result)
396{
397 pgbson_writer writer;
398 PgbsonWriterInit(&writer);
399
400 PgbsonWriterAppendUtf8(&writer, "db", 2, result->db);
401 PgbsonWriterAppendInt64(&writer, "collections", 11, result->collections);
402 PgbsonWriterAppendInt64(&writer, "views", 5, result->views);
403 PgbsonWriterAppendInt64(&writer, "objects", 7, result->objects);
404 PgbsonWriterAppendDouble(&writer, "avgObjSize", 10, result->avgObjSize);
405 PgbsonWriterAppendDouble(&writer, "dataSize", 8, result->dataSize);
406 PgbsonWriterAppendDouble(&writer, "storageSize", 11, result->storageSize);
407 PgbsonWriterAppendInt64(&writer, "indexes", 7, result->indexes);
408 PgbsonWriterAppendDouble(&writer, "indexSize", 9, result->indexSize);
409 PgbsonWriterAppendDouble(&writer, "totalSize", 9, result->totalSize);
410 PgbsonWriterAppendInt32(&writer, "scaleFactor", 11, result->scaleFactor);
411 PgbsonWriterAppendInt32(&writer, "ok", 2, result->ok);
412
413 return PgbsonWriterGetPgbson(&writer);
414}
415
416
417/*

Callers 1

DbStatsCoordinatorFunction · 0.70

Calls 6

PgbsonWriterInitFunction · 0.85
PgbsonWriterAppendUtf8Function · 0.85
PgbsonWriterAppendInt64Function · 0.85
PgbsonWriterAppendDoubleFunction · 0.85
PgbsonWriterAppendInt32Function · 0.85
PgbsonWriterGetPgbsonFunction · 0.85

Tested by

no test coverage detected