Files
oak-editor/app/render/diskmanager.h
T
itsmattkc 9c2c384833 created disk manager class
This is a singleton class that will manage the disk cache to ensure the size
stays at sane levels.
2020-01-09 20:20:47 +11:00

48 lines
739 B
C++

#ifndef DISKMANAGER_H
#define DISKMANAGER_H
#include <QObject>
class DiskManager : public QObject
{
Q_OBJECT
public:
static void CreateInstance();
static void DestroyInstance();
static DiskManager* instance();
void Accessed(const QByteArray& hash);
void CreatedFile(const QString& file_name, const QByteArray& hash);
signals:
void DeletedFrame(const QByteArray& hash);
private:
DiskManager();
virtual ~DiskManager() override;
static DiskManager* instance_;
void DeleteLeastRecent();
qint64 DiskLimit();
struct HashTime {
QString file_name;
QByteArray hash;
qint64 access_time;
qint64 file_size;
};
QList<HashTime> disk_data_;
qint64 consumption_;
};
#endif // DISKMANAGER_H