diff --git a/src/csync/csync.h b/src/csync/csync.h index 759bced4a..13125cc8e 100644 --- a/src/csync/csync.h +++ b/src/csync/csync.h @@ -136,8 +136,23 @@ enum ItemType { ItemTypeSoftLink = 1, ItemTypeDirectory = 2, ItemTypeSkip = 3, + + /** The file is a dehydrated placeholder, meaning data isn't available locally */ ItemTypeVirtualFile = 4, + + /** A ItemTypeVirtualFile that wants to be hydrated. + * + * Actions may put this in the db as a request to a future sync. + * For some vfs plugins the placeholder files on disk may be marked for + * dehydration (like with a file attribute) and then the local discovery + * will return this item type. + */ ItemTypeVirtualFileDownload = 5, + + /** A ItemTypeFile that wants to be dehydrated. + * + * May exist in db or local files, similar to ItemTypeVirtualFileDownload. + */ ItemTypeVirtualFileDehydration = 6, }; diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index d4bf83249..04e50292c 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -281,7 +281,8 @@ void ProcessDirectoryJob::processFile(PathTuple path, << " | checksum: " << dbEntry._checksumHeader << "//" << serverEntry.checksumHeader << " | perm: " << dbEntry._remotePerm << "//" << serverEntry.remotePerm << " | fileid: " << dbEntry._fileId << "//" << serverEntry.fileId - << " | inode: " << dbEntry._inode << "/" << localEntry.inode << "/"; + << " | inode: " << dbEntry._inode << "/" << localEntry.inode << "/" + << " | type: " << dbEntry._type << "/" << localEntry.type << "/" << (serverEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile); if (_discoveryData->isRenamed(path._original)) { qCDebug(lcDisco) << "Ignoring renamed"; @@ -325,7 +326,9 @@ void ProcessDirectoryJob::processFile(PathTuple path, // server-side nothing has changed // NOTE: Normally setting the VirtualFileDownload flag means that local and // remote will be rediscovered. This is just a fallback. - if (_queryServer == ParentNotChanged && dbEntry._type == ItemTypeVirtualFileDownload) { + if (_queryServer == ParentNotChanged + && (dbEntry._type == ItemTypeVirtualFileDownload + || localEntry.type == ItemTypeVirtualFileDownload)) { item->_direction = SyncFileItem::Down; item->_instruction = CSYNC_INSTRUCTION_NEW; item->_type = ItemTypeVirtualFileDownload; @@ -371,7 +374,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( item->_direction = SyncFileItem::Down; item->_modtime = serverEntry.modtime; item->_size = serverEntry.size; - } else if (dbEntry._type == ItemTypeVirtualFileDownload) { + } else if (dbEntry._type == ItemTypeVirtualFileDownload || localEntry.type == ItemTypeVirtualFileDownload) { item->_direction = SyncFileItem::Down; item->_instruction = CSYNC_INSTRUCTION_NEW; item->_type = ItemTypeVirtualFileDownload; @@ -706,7 +709,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( if (noServerEntry) { item->_instruction = CSYNC_INSTRUCTION_REMOVE; item->_direction = SyncFileItem::Down; - } else if (dbEntry._type == ItemTypeVirtualFileDehydration) { + } else if (dbEntry._type == ItemTypeVirtualFileDehydration || localEntry.type == ItemTypeVirtualFileDehydration) { item->_direction = SyncFileItem::Down; item->_instruction = CSYNC_INSTRUCTION_NEW; item->_type = ItemTypeVirtualFileDehydration; @@ -1340,7 +1343,8 @@ bool ProcessDirectoryJob::runLocalQuery() i.isDirectory = dirent->type == ItemTypeDirectory; i.isHidden = dirent->is_hidden; i.isSymLink = dirent->type == ItemTypeSoftLink; - i.isVirtualFile = dirent->type == ItemTypeVirtualFile; + i.isVirtualFile = dirent->type == ItemTypeVirtualFile || dirent->type == ItemTypeVirtualFileDownload; + i.type = dirent->type; _localNormalQueryEntries.push_back(i); } csync_vio_local_closedir(dh); diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 32c9b1332..6c6d7ff9f 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -68,6 +68,7 @@ struct LocalInfo time_t modtime = 0; int64_t size = 0; uint64_t inode = 0; + ItemType type = ItemTypeSkip; bool isDirectory = false; bool isHidden = false; bool isVirtualFile = false;