summaryrefslogtreecommitdiffstats
path: root/backends/mongodb/mongodb.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 11:49:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 12:42:05 +0000
commit2e85f9325a797977eea9dfea0a925775ddd211d9 (patch)
tree452c7f30d62fca5755f659b99e4e53c7b03afc21 /backends/mongodb/mongodb.c
parentReleasing debian version 1.19.0-4. (diff)
downloadnetdata-2e85f9325a797977eea9dfea0a925775ddd211d9.tar.xz
netdata-2e85f9325a797977eea9dfea0a925775ddd211d9.zip
Merging upstream version 1.29.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'backends/mongodb/mongodb.c')
-rw-r--r--backends/mongodb/mongodb.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/backends/mongodb/mongodb.c b/backends/mongodb/mongodb.c
index f40d8fa5f..d0527a723 100644
--- a/backends/mongodb/mongodb.c
+++ b/backends/mongodb/mongodb.c
@@ -6,10 +6,10 @@
#define CONFIG_FILE_LINE_MAX ((CONFIG_MAX_NAME + CONFIG_MAX_VALUE + 1024) * 2)
-mongoc_client_t *mongodb_client;
-mongoc_collection_t *mongodb_collection;
+static mongoc_client_t *mongodb_client;
+static mongoc_collection_t *mongodb_collection;
-int mongodb_init(const char *uri_string,
+int backends_mongodb_init(const char *uri_string,
const char *database_string,
const char *collection_string,
int32_t default_socket_timeout) {
@@ -47,7 +47,7 @@ int mongodb_init(const char *uri_string,
return 0;
}
-void free_bson(bson_t **insert, size_t n_documents) {
+void backends_free_bson(bson_t **insert, size_t n_documents) {
size_t i;
for(i = 0; i < n_documents; i++)
@@ -56,7 +56,7 @@ void free_bson(bson_t **insert, size_t n_documents) {
free(insert);
}
-int mongodb_insert(char *data, size_t n_metrics) {
+int backends_mongodb_insert(char *data, size_t n_metrics) {
bson_t **insert = calloc(n_metrics, sizeof(bson_t *));
bson_error_t error;
char *start = data, *end = data;
@@ -77,7 +77,7 @@ int mongodb_insert(char *data, size_t n_metrics) {
if(unlikely(!insert[n_documents])) {
error("BACKEND: %s", error.message);
- free_bson(insert, n_documents);
+ backends_free_bson(insert, n_documents);
return 1;
}
@@ -88,16 +88,16 @@ int mongodb_insert(char *data, size_t n_metrics) {
if(unlikely(!mongoc_collection_insert_many(mongodb_collection, (const bson_t **)insert, n_documents, NULL, NULL, &error))) {
error("BACKEND: %s", error.message);
- free_bson(insert, n_documents);
+ backends_free_bson(insert, n_documents);
return 1;
}
- free_bson(insert, n_documents);
+ backends_free_bson(insert, n_documents);
return 0;
}
-void mongodb_cleanup() {
+void backends_mongodb_cleanup() {
mongoc_collection_destroy(mongodb_collection);
mongoc_client_destroy(mongodb_client);
mongoc_cleanup();