2013-10-03 17:27:29 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
|
|
|
|
*
|
2017-09-01 19:11:43 +03:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2013-10-03 17:27:29 +04:00
|
|
|
*
|
2017-09-01 19:11:43 +03:00
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2013-10-03 17:27:29 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SYNCJOURNALFILERECORD_H
|
|
|
|
#define SYNCJOURNALFILERECORD_H
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
2017-12-14 17:08:53 +03:00
|
|
|
#include "csync.h"
|
2017-09-01 19:11:43 +03:00
|
|
|
#include "ocsynclib.h"
|
2017-09-19 11:53:51 +03:00
|
|
|
#include "remotepermissions.h"
|
2017-09-14 16:50:13 +03:00
|
|
|
#include "common/utility.h"
|
2014-09-26 12:07:17 +04:00
|
|
|
|
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;
|
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The SyncJournalFileRecord class
|
|
|
|
* @ingroup libsync
|
2015-06-26 18:07:47 +03:00
|
|
|
*/
|
2017-09-01 19:11:43 +03:00
|
|
|
class OCSYNC_EXPORT SyncJournalFileRecord
|
2013-10-03 17:27:29 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SyncJournalFileRecord();
|
2015-11-10 16:26:25 +03:00
|
|
|
|
2017-09-15 15:24:34 +03:00
|
|
|
bool isValid() const
|
2013-10-03 17:27:29 +04:00
|
|
|
{
|
|
|
|
return !_path.isEmpty();
|
|
|
|
}
|
|
|
|
|
2017-05-10 10:37:10 +03:00
|
|
|
/** Returns the numeric part of the full id in _fileId.
|
|
|
|
*
|
|
|
|
* On the server this is sometimes known as the internal file id.
|
|
|
|
*
|
|
|
|
* It is used in the construction of private links.
|
|
|
|
*/
|
|
|
|
QByteArray numericFileId() const;
|
2017-09-14 16:50:13 +03:00
|
|
|
QDateTime modDateTime() const { return Utility::qDateTimeFromTime_t(_modtime); }
|
2017-05-10 10:37:10 +03:00
|
|
|
|
2017-09-14 16:50:13 +03:00
|
|
|
QByteArray _path;
|
2015-07-09 16:57:56 +03:00
|
|
|
quint64 _inode;
|
2017-09-14 16:50:13 +03:00
|
|
|
qint64 _modtime;
|
2017-12-14 17:08:53 +03:00
|
|
|
ItemType _type;
|
2014-06-19 16:27:04 +04:00
|
|
|
QByteArray _etag;
|
|
|
|
QByteArray _fileId;
|
2014-09-05 15:03:33 +04:00
|
|
|
qint64 _fileSize;
|
2017-09-19 11:53:51 +03:00
|
|
|
RemotePermissions _remotePerm;
|
2015-07-13 16:41:11 +03:00
|
|
|
bool _serverHasIgnoredFiles;
|
2017-06-14 13:14:46 +03:00
|
|
|
QByteArray _checksumHeader;
|
2018-02-12 14:50:51 +03:00
|
|
|
QByteArray _e2eMangledName;
|
2013-10-03 17:27:29 +04:00
|
|
|
};
|
|
|
|
|
2017-09-01 19:11:43 +03:00
|
|
|
bool OCSYNC_EXPORT
|
2014-11-19 16:14:54 +03:00
|
|
|
operator==(const SyncJournalFileRecord &lhs,
|
|
|
|
const SyncJournalFileRecord &rhs);
|
2014-10-23 17:15:47 +04:00
|
|
|
|
2017-09-01 19:11:43 +03:00
|
|
|
class OCSYNC_EXPORT SyncJournalErrorBlacklistRecord
|
2013-11-20 16:44:01 +04:00
|
|
|
{
|
|
|
|
public:
|
2017-07-07 16:11:00 +03:00
|
|
|
enum Category {
|
|
|
|
/// Normal errors have no special behavior
|
|
|
|
Normal = 0,
|
|
|
|
/// These get a special summary message
|
|
|
|
InsufficientRemoteStorage
|
|
|
|
};
|
|
|
|
|
2015-01-16 12:17:19 +03:00
|
|
|
SyncJournalErrorBlacklistRecord()
|
2014-10-09 16:49:51 +04:00
|
|
|
: _retryCount(0)
|
2017-07-07 16:11:00 +03:00
|
|
|
, _errorCategory(Category::Normal)
|
2014-10-09 16:49:51 +04:00
|
|
|
, _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;
|
2017-07-07 16:11:00 +03:00
|
|
|
/// The error category. Sometimes used for special actions.
|
|
|
|
Category _errorCategory;
|
2014-10-09 16:49:51 +04:00
|
|
|
|
2017-09-14 16:50:13 +03:00
|
|
|
qint64 _lastTryModtime;
|
2013-11-20 16:44:01 +04:00
|
|
|
QByteArray _lastTryEtag;
|
2014-10-09 16:49:51 +04:00
|
|
|
|
|
|
|
/// The last time the operation was attempted (in s since epoch).
|
2017-09-14 16:50:13 +03:00
|
|
|
qint64 _lastTryTime;
|
2014-10-09 16:49:51 +04:00
|
|
|
|
|
|
|
/// The number of seconds the file shall be ignored.
|
2017-09-14 16:50:13 +03:00
|
|
|
qint64 _ignoreDuration;
|
2014-10-09 16:49:51 +04:00
|
|
|
|
2013-11-20 16:44:01 +04:00
|
|
|
QString _file;
|
2016-05-25 16:01:26 +03:00
|
|
|
QString _renameTarget;
|
2013-11-20 16:44:01 +04:00
|
|
|
|
2014-10-09 16:49:51 +04:00
|
|
|
bool isValid() const;
|
2013-11-20 16:44:01 +04:00
|
|
|
};
|
2017-12-02 13:40:43 +03:00
|
|
|
|
|
|
|
/** Represents a conflict in the conflicts table.
|
|
|
|
*
|
|
|
|
* In the following the "conflict file" is the file with the "_conflict-"
|
|
|
|
* tag and the base file is the file that its a conflict for. So if
|
|
|
|
* a/foo.txt is the base file, its conflict file could be
|
|
|
|
* a/foo_conflict-1234.txt.
|
|
|
|
*/
|
|
|
|
class OCSYNC_EXPORT ConflictRecord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Path to the _conflict- file
|
|
|
|
*
|
|
|
|
* So if a/foo.txt has a conflict, this path would point to
|
|
|
|
* a/foo_conflict-1234.txt.
|
|
|
|
*
|
|
|
|
* The path is sync-folder relative.
|
|
|
|
*/
|
|
|
|
QByteArray path;
|
|
|
|
|
|
|
|
/// File id of the base file
|
|
|
|
QByteArray baseFileId;
|
|
|
|
|
|
|
|
/** Modtime of the base file
|
|
|
|
*
|
|
|
|
* may not be available and be -1
|
|
|
|
*/
|
|
|
|
qint64 baseModtime = -1;
|
|
|
|
|
|
|
|
/** Etag of the base file
|
|
|
|
*
|
|
|
|
* may not be available and empty
|
|
|
|
*/
|
|
|
|
QByteArray baseEtag;
|
|
|
|
|
|
|
|
bool isValid() const { return !path.isEmpty(); }
|
|
|
|
};
|
2013-10-03 17:27:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SYNCJOURNALFILERECORD_H
|