You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
955 B

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __DATA_BINARY_LOGGING_HEADERS__
  2. #define __DATA_BINARY_LOGGING_HEADERS__
  3. typedef enum E_BLOG_STATUS{
  4. BLOG_RECORD_EMPTY = 0,
  5. BLOG_RECORD_OK = 1,
  6. BLOG_RECORD_BUSY = 2,
  7. BLOG_RECORD_DELETED = 255
  8. }BLOG_STATUS;
  9. typedef struct S_BLOG_RECORD{
  10. uint8_t crc;
  11. uint8_t * data;
  12. uint32_t size;
  13. uint32_t uts;
  14. uint8_t status;
  15. }BLOG_RECORD;
  16. typedef enum E_BLOG_STATUS{
  17. }BLOG_STATUS;
  18. class binaryStorage{
  19. private:
  20. uint64_t m_nCurrentSize;
  21. uint32_t m_nPartSize;
  22. uint32_t m_nRecordsCount;
  23. basicMutex m_mOpProtector;
  24. char m_cFileName[MAX_PATH];
  25. public:
  26. explicit binaryStorage( CSTR StorageName, uint32_t partitionSize = 0 );
  27. virtual ~binaryStorage();
  28. getCounts();
  29. uint32_t fetch_first( uint32_t ts );
  30. uint32_t fetch_last( uint32_t ts );
  31. BLOG_RECORD * getRecord( uint32_t id );
  32. bool validate();
  33. bool updateRecord( uint32_t id, uint8_t *data, uint32_t size );
  34. };
  35. #endif