rrdengineapi.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_RRDENGINEAPI_H
  3. #define NETDATA_RRDENGINEAPI_H
  4. #include "rrdengine.h"
  5. #define RRDENG_MIN_PAGE_CACHE_SIZE_MB (8)
  6. #define RRDENG_MIN_DISK_SPACE_MB (64)
  7. #define RRDENG_NR_STATS (37)
  8. #define RRDENG_FD_BUDGET_PER_INSTANCE (50)
  9. extern int default_rrdeng_page_cache_mb;
  10. extern int default_rrdeng_disk_quota_mb;
  11. extern int default_multidb_disk_quota_mb;
  12. extern uint8_t rrdeng_drop_metrics_under_page_cache_pressure;
  13. extern struct rrdengine_instance multidb_ctx;
  14. struct rrdeng_region_info {
  15. time_t start_time;
  16. int update_every;
  17. unsigned points;
  18. };
  19. extern void *rrdeng_create_page(struct rrdengine_instance *ctx, uuid_t *id, struct rrdeng_page_descr **ret_descr);
  20. extern void rrdeng_commit_page(struct rrdengine_instance *ctx, struct rrdeng_page_descr *descr,
  21. Word_t page_correlation_id);
  22. extern void *rrdeng_get_latest_page(struct rrdengine_instance *ctx, uuid_t *id, void **handle);
  23. extern void *rrdeng_get_page(struct rrdengine_instance *ctx, uuid_t *id, usec_t point_in_time, void **handle);
  24. extern void rrdeng_put_page(struct rrdengine_instance *ctx, void *handle);
  25. extern void rrdeng_generate_legacy_uuid(const char *dim_id, char *chart_id, uuid_t *ret_uuid);
  26. extern void rrdeng_convert_legacy_uuid_to_multihost(char machine_guid[GUID_LEN + 1], uuid_t *legacy_uuid,
  27. uuid_t *ret_uuid);
  28. extern void rrdeng_metric_init(RRDDIM *rd);
  29. extern void rrdeng_store_metric_init(RRDDIM *rd);
  30. extern void rrdeng_store_metric_flush_current_page(RRDDIM *rd);
  31. extern void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number number);
  32. extern int rrdeng_store_metric_finalize(RRDDIM *rd);
  33. extern unsigned
  34. rrdeng_variable_step_boundaries(RRDSET *st, time_t start_time, time_t end_time,
  35. struct rrdeng_region_info **region_info_arrayp, unsigned *max_intervalp, struct context_param *context_param_list);
  36. extern void rrdeng_load_metric_init(RRDDIM *rd, struct rrddim_query_handle *rrdimm_handle,
  37. time_t start_time, time_t end_time);
  38. extern storage_number rrdeng_load_metric_next(struct rrddim_query_handle *rrdimm_handle, time_t *current_time);
  39. extern int rrdeng_load_metric_is_finished(struct rrddim_query_handle *rrdimm_handle);
  40. extern void rrdeng_load_metric_finalize(struct rrddim_query_handle *rrdimm_handle);
  41. extern time_t rrdeng_metric_latest_time(RRDDIM *rd);
  42. extern time_t rrdeng_metric_oldest_time(RRDDIM *rd);
  43. extern void rrdeng_get_37_statistics(struct rrdengine_instance *ctx, unsigned long long *array);
  44. /* must call once before using anything */
  45. extern int rrdeng_init(RRDHOST *host, struct rrdengine_instance **ctxp, char *dbfiles_path, unsigned page_cache_mb,
  46. unsigned disk_space_mb);
  47. extern int rrdeng_exit(struct rrdengine_instance *ctx);
  48. extern void rrdeng_prepare_exit(struct rrdengine_instance *ctx);
  49. extern int rrdeng_metric_latest_time_by_uuid(uuid_t *dim_uuid, time_t *first_entry_t, time_t *last_entry_t);
  50. #endif /* NETDATA_RRDENGINEAPI_H */