]> git.sesse.net Git - nageru/blob - db.h
Allow symlinked frame files. Useful for testing.
[nageru] / db.h
1 #ifndef DB_H
2 #define DB_H 1
3
4 #include "state.pb.h"
5
6 #include <sqlite3.h>
7 #include <string>
8 #include <vector>
9
10 #include "frame_on_disk.h"
11
12 class DB {
13 public:
14         explicit DB(const std::string &filename);
15         DB(const DB &) = delete;
16
17         StateProto get_state();
18         void store_state(const StateProto &state);
19
20         struct FrameOnDiskAndStreamIdx {
21                 FrameOnDisk frame;
22                 unsigned stream_idx;
23         };
24         std::vector<FrameOnDiskAndStreamIdx> load_frame_file(const std::string &filename, size_t size, unsigned frame_idx);  // Empty = none found, or there were no frames.
25         void store_frame_file(const std::string &filename, size_t size, const std::vector<FrameOnDiskAndStreamIdx> &frames);
26
27 private:
28         StateProto state;
29         sqlite3 *db;
30 };
31
32 #endif  // !defined(DB_H)