log_db.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef LOG_SDK_LOG_DB_H
  2. #define LOG_SDK_LOG_DB_H
  3. #include "log_builder.h"
  4. typedef enum {
  5. LOG_DB_STATUS_WAITING, LOG_DB_STATUS_SENDING
  6. }log_db_status_e;
  7. LOG_CPP_START
  8. typedef struct _log_db_manager log_db_manager;
  9. log_db_manager* create_log_db(log_producer_config* config, char* base_path, char* file_name, char* table_name);
  10. void destroy_log_db(log_db_manager* manager);
  11. int open_db(log_db_manager* manager);
  12. //multiple definition of `close_db' with sqlite3 shell.c
  13. void close_logdb(log_db_manager* manager);
  14. int drop_db(log_db_manager* manager);
  15. int db_transaction_begin(log_db_manager* manager);
  16. int db_transaction_commit(log_db_manager* manager);
  17. int db_insert_group(log_db_manager* manager, log_group_builder* builder);
  18. int db_insert_one(log_db_manager* manager, serialize_buf* buf);
  19. log_group_builder* db_read_table_last_logs(log_db_manager* manager, int count);
  20. int db_get_count(log_db_manager* manager);
  21. int db_delete_one(log_db_manager* manager, char* uuid);
  22. int db_delete_old_logs(log_db_manager* manager, int count);
  23. int db_update_status(log_db_manager* manager, char* uuid, log_db_status_e status);
  24. int db_is_exist_table_ex(log_db_manager* manager, char* tablename);
  25. int db_get_tables(log_db_manager* manager, char** tables, int* table_count);
  26. int db_vacuum(log_db_manager* manager);
  27. LOG_CPP_END
  28. #endif