2013-10-03 17:27:29 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SYNCJOURNALFILERECORD_H
|
|
|
|
#define SYNCJOURNALFILERECORD_H
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
2014-09-26 12:07:17 +04:00
|
|
|
#include "owncloudlib.h"
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2013-10-03 17:27:29 +04:00
|
|
|
|
2013-10-03 22:00:58 +04:00
|
|
|
class SyncFileItem;
|
|
|
|
|
2014-09-26 12:07:17 +04:00
|
|
|
class OWNCLOUDSYNC_EXPORT SyncJournalFileRecord
|
2013-10-03 17:27:29 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SyncJournalFileRecord();
|
2013-10-03 22:00:58 +04:00
|
|
|
SyncJournalFileRecord(const SyncFileItem&, const QString &localFileName);
|
2013-10-03 17:27:29 +04:00
|
|
|
|
|
|
|
bool isValid() {
|
|
|
|
return !_path.isEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString _path;
|
2013-11-13 17:30:08 +04:00
|
|
|
quint64 _inode;
|
2013-10-03 17:27:29 +04:00
|
|
|
QDateTime _modtime;
|
|
|
|
int _type;
|
2014-06-19 16:27:04 +04:00
|
|
|
QByteArray _etag;
|
|
|
|
QByteArray _fileId;
|
2014-09-05 15:03:33 +04:00
|
|
|
qint64 _fileSize;
|
2014-06-06 17:24:17 +04:00
|
|
|
QByteArray _remotePerm;
|
2013-11-13 17:30:08 +04:00
|
|
|
int _mode;
|
2013-10-03 17:27:29 +04:00
|
|
|
};
|
|
|
|
|
2014-11-19 16:14:54 +03:00
|
|
|
bool OWNCLOUDSYNC_EXPORT
|
|
|
|
operator==(const SyncJournalFileRecord & lhs,
|
|
|
|
const SyncJournalFileRecord & rhs);
|
2014-10-23 17:15:47 +04:00
|
|
|
|
2015-01-16 12:17:19 +03:00
|
|
|
class SyncJournalErrorBlacklistRecord
|
2013-11-20 16:44:01 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-01-16 12:17:19 +03:00
|
|
|
SyncJournalErrorBlacklistRecord()
|
2014-10-09 16:49:51 +04:00
|
|
|
: _retryCount(0)
|
|
|
|
, _lastTryModtime(0)
|
|
|
|
, _lastTryTime(0)
|
|
|
|
, _ignoreDuration(0)
|
|
|
|
{}
|
2013-11-20 16:44:01 +04:00
|
|
|
|
2014-10-09 16:49:51 +04:00
|
|
|
/// The number of times the operation was unsuccessful so far.
|
2013-11-20 16:44:01 +04:00
|
|
|
int _retryCount;
|
2014-10-09 16:49:51 +04:00
|
|
|
|
|
|
|
/// The last error string.
|
2013-11-20 16:44:01 +04:00
|
|
|
QString _errorString;
|
2014-10-09 16:49:51 +04:00
|
|
|
|
2013-11-20 16:44:01 +04:00
|
|
|
time_t _lastTryModtime;
|
|
|
|
QByteArray _lastTryEtag;
|
2014-10-09 16:49:51 +04:00
|
|
|
|
|
|
|
/// The last time the operation was attempted (in s since epoch).
|
|
|
|
time_t _lastTryTime;
|
|
|
|
|
|
|
|
/// The number of seconds the file shall be ignored.
|
|
|
|
time_t _ignoreDuration;
|
|
|
|
|
2013-11-20 16:44:01 +04:00
|
|
|
QString _file;
|
|
|
|
|
2014-10-09 16:49:51 +04:00
|
|
|
bool isValid() const;
|
|
|
|
|
|
|
|
/** Takes an old blacklist entry and updates it for a new sync result.
|
|
|
|
*
|
|
|
|
* The old entry may be invalid, then a fresh entry is created.
|
|
|
|
* If the returned record is invalid, the file shall not be
|
|
|
|
* blacklisted.
|
|
|
|
*/
|
2015-01-16 12:17:19 +03:00
|
|
|
static SyncJournalErrorBlacklistRecord update(
|
|
|
|
const SyncJournalErrorBlacklistRecord& old, const SyncFileItem& item);
|
2013-11-20 16:44:01 +04:00
|
|
|
};
|
|
|
|
|
2013-10-03 17:27:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SYNCJOURNALFILERECORD_H
|