Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-07-15 12:58:40 +0300
committerHannah von Reth <vonreth@kde.org>2021-07-29 15:41:16 +0300
commit8505c8d5ec230c25ced842a9b5a1af408fbd774f (patch)
tree9cc93dc173332e62488317166372a02984eb8564 /src/common
parentd606e003b62382948c1b768ec81f4b0d37cf42a3 (diff)
Unify calls to updateMetadata
We now call convertToPlacholder in vfs->updateMetaData. We now always go through the propagator to prevent code duplication.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/vfs.h37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/common/vfs.h b/src/common/vfs.h
index 04a9f2003..e3d0b4cdb 100644
--- a/src/common/vfs.h
+++ b/src/common/vfs.h
@@ -157,13 +157,6 @@ public:
*/
virtual bool isHydrating() const = 0;
- /** Update placeholder metadata during discovery.
- *
- * If the remote metadata changes, the local placeholder's metadata should possibly
- * change as well.
- */
- virtual OC_REQUIRED_RESULT Result<void, QString> updateMetadata(const QString &filePath, time_t modtime, qint64 size, const QByteArray &fileId) = 0;
-
/// Create a new dehydrated placeholder. Called from PropagateDownload.
virtual OC_REQUIRED_RESULT Result<void, QString> createPlaceholder(const SyncFileItem &item) = 0;
@@ -181,24 +174,6 @@ public:
*/
virtual OC_REQUIRED_RESULT bool needsMetadataUpdate(const SyncFileItem &item) = 0;
- /** Convert a new file to a hydrated placeholder.
- *
- * Some VFS integrations expect that every file, including those that have all
- * the remote data, are "placeholders". This function is called by PropagateDownload
- * to convert newly downloaded, fully hydrated files into placeholders.
- *
- * Implementations must make sure that calling this function on a file that already
- * is a placeholder is acceptable.
- *
- * replacesFile can optionally contain a filesystem path to a placeholder that this
- * new placeholder shall supersede, for rename-replace actions with new downloads,
- * for example.
- */
- virtual OC_REQUIRED_RESULT Result<ConvertToPlaceholderResult, QString> convertToPlaceholder(
- const QString &filename,
- const SyncFileItem &item,
- const QString &replacesFile = QString()) = 0;
-
/// Determine whether the file at the given absolute path is a dehydrated placeholder.
virtual OC_REQUIRED_RESULT bool isDehydratedPlaceholder(const QString &filePath) = 0;
@@ -258,6 +233,13 @@ signals:
void doneHydrating();
protected:
+ /** Update placeholder metadata during discovery.
+ *
+ * If the remote metadata changes, the local placeholder's metadata should possibly
+ * change as well.
+ */
+ virtual OC_REQUIRED_RESULT Result<ConvertToPlaceholderResult, QString> updateMetadata(const QString &filePath, const SyncFileItem &item, const QString &replacesFile = {}) = 0;
+
/** Setup the plugin for the folder.
*
* For example, the VFS provider might monitor files to be able to start a file
@@ -276,6 +258,8 @@ protected:
// the parameters passed to start()
VfsSetupParams _setupParams;
+
+ friend class OwncloudPropagator;
};
/// Implementation of Vfs for Vfs::Off mode - does nothing
@@ -297,10 +281,8 @@ public:
bool socketApiPinStateActionsShown() const override { return false; }
bool isHydrating() const override { return false; }
- Result<void, QString> updateMetadata(const QString &, time_t, qint64, const QByteArray &) override { return {}; }
Result<void, QString> createPlaceholder(const SyncFileItem &) override { return {}; }
Result<void, QString> dehydratePlaceholder(const SyncFileItem &) override { return {}; }
- Result<ConvertToPlaceholderResult, QString> convertToPlaceholder(const QString &, const SyncFileItem &, const QString &) override { return ConvertToPlaceholderResult::Ok; }
bool needsMetadataUpdate(const SyncFileItem &) override { return false; }
bool isDehydratedPlaceholder(const QString &) override { return false; }
@@ -314,6 +296,7 @@ public slots:
void fileStatusChanged(const QString &, SyncFileStatus) override {}
protected:
+ Result<ConvertToPlaceholderResult, QString> updateMetadata(const QString &, const SyncFileItem &, const QString & = {}) override { return { ConvertToPlaceholderResult::Ok }; }
void startImpl(const VfsSetupParams &) override {}
};