nextcloud-desktop/src/common/syncjournalfilerecord.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

113 lines
2.8 KiB
C
Raw Normal View History

/*
* 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.
*
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
*/
#ifndef SYNCJOURNALFILERECORD_H
#define SYNCJOURNALFILERECORD_H
#include <QString>
#include <QDateTime>
2017-09-01 19:11:43 +03:00
#include "ocsynclib.h"
2014-11-10 00:34:07 +03:00
namespace OCC {
2013-10-03 22:00:58 +04:00
class SyncFileItem;
2015-06-29 19:56:09 +03:00
/**
* @brief The SyncJournalFileRecord class
* @ingroup libsync
*/
2017-09-01 19:11:43 +03:00
class OCSYNC_EXPORT SyncJournalFileRecord
{
public:
SyncJournalFileRecord();
bool isValid()
{
return !_path.isEmpty();
}
/** 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;
QString _path;
quint64 _inode;
QDateTime _modtime;
int _type;
QByteArray _etag;
QByteArray _fileId;
qint64 _fileSize;
QByteArray _remotePerm;
bool _serverHasIgnoredFiles;
QByteArray _checksumHeader;
};
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);
2017-09-01 19:11:43 +03:00
class OCSYNC_EXPORT SyncJournalErrorBlacklistRecord
{
public:
enum Category {
/// Normal errors have no special behavior
Normal = 0,
/// These get a special summary message
InsufficientRemoteStorage
};
SyncJournalErrorBlacklistRecord()
: _retryCount(0)
, _errorCategory(Category::Normal)
, _lastTryModtime(0)
, _lastTryTime(0)
, _ignoreDuration(0)
{
}
/// The number of times the operation was unsuccessful so far.
int _retryCount;
/// The last error string.
QString _errorString;
/// The error category. Sometimes used for special actions.
Category _errorCategory;
time_t _lastTryModtime;
QByteArray _lastTryEtag;
/// 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;
QString _file;
QString _renameTarget;
bool isValid() const;
};
}
#endif // SYNCJOURNALFILERECORD_H