storage_engine.h 979 B

1234567891011121314151617181920212223242526272829303132
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_STORAGEENGINEAPI_H
  3. #define NETDATA_STORAGEENGINEAPI_H
  4. #include "rrd.h"
  5. typedef struct storage_engine STORAGE_ENGINE;
  6. // ------------------------------------------------------------------------
  7. // function pointers for all APIs provided by a storge engine
  8. typedef struct storage_engine_api {
  9. STORAGE_METRIC_HANDLE *(*init)(RRDDIM *rd, STORAGE_INSTANCE *instance);
  10. void (*free)(STORAGE_METRIC_HANDLE *);
  11. struct rrddim_collect_ops collect_ops;
  12. struct rrddim_query_ops query_ops;
  13. } STORAGE_ENGINE_API;
  14. struct storage_engine {
  15. RRD_MEMORY_MODE id;
  16. const char* name;
  17. STORAGE_ENGINE_API api;
  18. };
  19. extern STORAGE_ENGINE* storage_engine_get(RRD_MEMORY_MODE mmode);
  20. extern STORAGE_ENGINE* storage_engine_find(const char* name);
  21. // Iterator over existing engines
  22. extern STORAGE_ENGINE* storage_engine_foreach_init();
  23. extern STORAGE_ENGINE* storage_engine_foreach_next(STORAGE_ENGINE* it);
  24. #endif