mongodb.h 881 B

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