X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fdb.h;fp=futatabi%2Fdb.h;h=f8032c0e43d3502360fc74346de0ea87684a26f5;hb=6e116a6bbeb2c047a3bfb084395ec601ce211e6c;hp=0000000000000000000000000000000000000000;hpb=ce2e0615420b706e1ff2405fffcedfba37a9adac;p=nageru diff --git a/futatabi/db.h b/futatabi/db.h new file mode 100644 index 0000000..f8032c0 --- /dev/null +++ b/futatabi/db.h @@ -0,0 +1,33 @@ +#ifndef DB_H +#define DB_H 1 + +#include "state.pb.h" + +#include +#include +#include + +#include "frame_on_disk.h" + +class DB { +public: + explicit DB(const std::string &filename); + DB(const DB &) = delete; + + StateProto get_state(); + void store_state(const StateProto &state); + + struct FrameOnDiskAndStreamIdx { + FrameOnDisk frame; + unsigned stream_idx; + }; + std::vector load_frame_file(const std::string &filename, size_t size, unsigned frame_idx); // Empty = none found, or there were no frames. + void store_frame_file(const std::string &filename, size_t size, const std::vector &frames); + void clean_unused_frame_files(const std::vector &used_filenames); + +private: + StateProto state; + sqlite3 *db; +}; + +#endif // !defined(DB_H)