14 #ifndef hifi_OctreePersistThread_h
15 #define hifi_OctreePersistThread_h
18 #include <QtCore/QSharedPointer>
19 #include <GenericThread.h>
22 class OctreePersistThread :
public QObject {
29 QString extensionFormat;
30 int maxBackupVersions;
34 static const std::chrono::seconds DEFAULT_PERSIST_INTERVAL;
36 OctreePersistThread(OctreePointer tree,
37 const QString& filename,
38 std::chrono::milliseconds persistInterval = DEFAULT_PERSIST_INTERVAL,
39 bool debugTimestampNow =
false,
40 QString persistAsFileType =
"json.gz");
42 bool isInitialLoadComplete()
const {
return _initialLoadComplete; }
43 quint64 getLoadElapsedTime()
const {
return _loadTimeUSecs; }
45 QString getPersistFilename()
const {
return _filename; }
46 QString getPersistFileMimeType()
const;
47 QByteArray getPersistFileContents()
const;
59 void handleOctreeDataFileReply(QSharedPointer<ReceivedMessage> message);
63 bool backupCurrentFile();
64 void cleanupOldReplacementBackups();
66 void replaceData(QByteArray data);
67 void sendLatestEntityDataToDS();
72 std::chrono::milliseconds _persistInterval;
73 std::chrono::steady_clock::time_point _lastPersistCheck;
74 bool _initialLoadComplete;
76 quint64 _loadTimeUSecs;
78 bool _debugTimestampNow;
79 quint64 _lastTimeDebug;
81 QString _persistAsFileType;
82 QByteArray _cachedJSONData;