| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_EXPORTING_MONGODB_H |
| 4 | #define NETDATA_EXPORTING_MONGODB_H |
| 5 | |
| 6 | #include "exporting/exporting_engine.h" |
| 7 | #include "exporting/json/json.h" |
| 8 | #include <mongoc.h> |
| 9 | |
| 10 | struct bson_buffer { |
| 11 | bson_t **insert; |
| 12 | size_t documents_inserted; |
| 13 | size_t buffered_bytes; |
| 14 | |
| 15 | struct bson_buffer *next; |
| 16 | }; |
| 17 | |
| 18 | struct mongodb_specific_data { |
| 19 | mongoc_client_t *client; |
| 20 | mongoc_collection_t *collection; |
| 21 | |
| 22 | size_t total_documents_inserted; |
| 23 | |
| 24 | struct bson_buffer *first_buffer; |
| 25 | struct bson_buffer *last_buffer; |
| 26 | }; |
| 27 | |
| 28 | int mongodb_init(struct instance *instance); |
| 29 | void mongodb_cleanup(struct instance *instance); |
| 30 | |
| 31 | int init_mongodb_instance(struct instance *instance); |
| 32 | int format_batch_mongodb(struct instance *instance); |
| 33 | void mongodb_connector_worker(void *instance_p); |
| 34 | |
| 35 | #endif //NETDATA_EXPORTING_MONGODB_H |