12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #pragma once
- #ifndef TSDB_CPP_HPP
- #define TSDB_CPP_HPP
- #include <cstdio>
- #include <cstring>
- #include <memory>
- #include <string_view>
- #include <vector>
- #ifdef _WIN32
- #define TSDB_EXPORT __declspec(dllexport)
- #else
- #define TSDB_EXPORT
- #endif
- TSDB_EXPORT void tsdb();
- TSDB_EXPORT void tsdb_print_vector(const std::vector<std::string>& strings);
- namespace tsdb_cpp {
- /// @brief A point in time series database.
- struct point {
- const std::string& name_;
- double value_;
- long long nanoseconds_;
- point(const std::string& name, double value, long long nanoseconds) : name_(name), value_(value), nanoseconds_(nanoseconds) {}
- };
- struct tsdb_entry_impl;
- /// @brief A time series database.
- struct tsdb_entry {
- tsdb_entry(std::string_view remote);
- ~tsdb_entry();
- tsdb_entry(tsdb_entry&& other);
- void close();
- void create_table();
- void create_memory_table();
- void drop_table();
- void drop_memory_table();
- void set_active_table(std::string_view table_name);
- void set_metric_name(std::string_view metric_name);
- void insert_point(const point& p);
- void insert_points(const std::vector<point>& points);
- private:
- std::unique_ptr<tsdb_entry_impl> impl_;
- };
- } // namespace tsdb_cpp
- #endif // TSDB_CPP_HPP
|