This unifies how to deal with pin states.
Also enable reading a folders direct pin state vs its effective pin
state.
query.exec();
}
-PinState SyncJournalDb::pinStateForPath(const QByteArray &path)
+Optional<PinState> SyncJournalDb::rawPinStateForPath(const QByteArray &path)
{
QMutexLocker lock(&_mutex);
if (!checkConnect())
- return PinState::Unspecified;
+ return {};
+
+ auto &query = _getRawPinStateQuery;
+ ASSERT(query.initOrReset(QByteArrayLiteral(
+ "SELECT pinState FROM flags WHERE path == ?1;"),
+ _db));
+ query.bindValue(1, path);
+ query.exec();
+
+ // no-entry means Inherited
+ if (!query.next())
+ return PinState::Inherited;
+
+ return static_cast<PinState>(query.intValue(0));
+}
+
+Optional<PinState> SyncJournalDb::effectivePinStateForPath(const QByteArray &path)
+{
+ QMutexLocker lock(&_mutex);
+ if (!checkConnect())
+ return {};
- auto &query = _getPinStateQuery;
+ auto &query = _getEffectivePinStateQuery;
ASSERT(query.initOrReset(QByteArrayLiteral(
"SELECT pinState FROM flags WHERE"
- " " IS_PREFIX_PATH_OR_EQUAL("path", "?1")
+ // explicitly allow "" to represent the root path
+ // (it'd be great if paths started with a / and "/" could be the root)
+ " (" IS_PREFIX_PATH_OR_EQUAL("path", "?1") " OR path == '')"
" AND pinState is not null AND pinState != 0"
" ORDER BY length(path) DESC;"),
_db));
query.bindValue(1, path);
query.exec();
+ // If the root path has no setting, assume AlwaysLocal
if (!query.next())
- return PinState::Unspecified;
+ return PinState::AlwaysLocal;
return static_cast<PinState>(query.intValue(0));
}
#include "common/utility.h"
#include "common/ownsql.h"
#include "common/syncjournalfilerecord.h"
+#include "common/result.h"
namespace OCC {
class SyncJournalFileRecord;
/** Determines whether files should be available locally or not
*
* For new remote files the file's PinState is calculated by looking for
- * the closest parent folder that isn't Unspecified.
+ * the closest parent folder that isn't Inherited.
*
* TODO: It seems to make sense to also store per-file PinStates.
* Maybe these could communicate intent, similar to ItemTypeVirtualFileDownload
*/
enum class PinState {
/// Inherit the PinState of the parent directory (default)
- Unspecified = 0,
+ Inherited = 0,
/// Download file and keep it updated.
AlwaysLocal = 1,
/// File shall be virtual locally.
void markVirtualFileForDownloadRecursively(const QByteArray &path);
/**
- * Gets the PinState for the path.
+ * Gets the PinState for the path without considering parents.
*
- * If the exact path has no entry or has an unspecified state,
- * the state is inherited through the parent.
+ * If a path has no explicit PinState "Inherited" is returned.
+ *
+ * It's valid to use the root path "".
+ *
+ * Returns none on db error.
+ */
+ Optional<PinState> rawPinStateForPath(const QByteArray &path);
+
+ /**
+ * Gets the PinState for the path after inheriting from parents.
+ *
+ * If the exact path has no entry or has an Inherited state,
+ * the state of the closest parent path is returned.
+ *
+ * It's valid to use the root path "".
+ *
+ * Never returns PinState::Inherited. If the root is "Inherited"
+ * or there's an error, "AlwaysLocal" is returned.
+ *
+ * Returns none on db error.
*/
- PinState pinStateForPath(const QByteArray &path);
+ Optional<PinState> effectivePinStateForPath(const QByteArray &path);
/**
* Sets a path's pin state.
+ *
+ * It's valid to use the root path "".
*/
void setPinStateForPath(const QByteArray &path, PinState state);
SqlQuery _getConflictRecordQuery;
SqlQuery _setConflictRecordQuery;
SqlQuery _deleteConflictRecordQuery;
- SqlQuery _getPinStateQuery;
+ SqlQuery _getRawPinStateQuery;
+ SqlQuery _getEffectivePinStateQuery;
SqlQuery _setPinStateQuery;
/* Storing etags to these folders, or their parent folders, is filtered out.
if (folderWizard->property("useVirtualFiles").toBool()) {
definition.virtualFilesMode = bestAvailableVfsMode();
- if (definition.virtualFilesMode != Vfs::Off)
- definition.newFilesAreVirtual = true;
}
{
Folder *f = folderMan->addFolder(_accountState, definition);
if (f) {
+ if (definition.virtualFilesMode != Vfs::Off && folderWizard->property("useVirtualFiles").toBool())
+ f->setNewFilesAreVirtual(true);
+
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, selectiveSyncBlackList);
// The user already accepted the selective sync dialog. everything is in the white list
bool Folder::newFilesAreVirtual() const
{
- return _definition.newFilesAreVirtual;
+ auto pinState = _journal.rawPinStateForPath("");
+ return pinState && *pinState == PinState::OnlineOnly;
}
void Folder::setNewFilesAreVirtual(bool enabled)
{
- _definition.newFilesAreVirtual = enabled;
- saveToSettings();
+ _journal.setPinStateForPath("", enabled ? PinState::OnlineOnly : PinState::AlwaysLocal);
}
void Folder::saveToSettings() const
settings->beginGroup(settingsGroup);
// Note: Each of these groups might have a "version" tag, but that's
// currently unused.
+ settings->beginGroup(FolderMan::escapeAlias(_definition.alias));
FolderDefinition::save(*settings, _definition);
+ // Technically redundant, just for older clients
+ settings->setValue(QLatin1String("usePlaceholders"), newFilesAreVirtual());
+
settings->sync();
qCInfo(lcFolder) << "Saved folder" << _definition.alias << "to settings, status" << settings->status();
}
opt._confirmExternalStorage = cfgFile.confirmExternalStorage();
opt._moveFilesToTrash = cfgFile.moveToTrash();
opt._vfs = _vfs;
- opt._newFilesAreVirtual = _definition.newFilesAreVirtual;
QByteArray chunkSizeEnv = qgetenv("OWNCLOUD_CHUNK_SIZE");
if (!chunkSizeEnv.isEmpty()) {
void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder)
{
- settings.beginGroup(FolderMan::escapeAlias(folder.alias));
settings.setValue(QLatin1String("localPath"), folder.localPath);
settings.setValue(QLatin1String("journalPath"), folder.journalPath);
settings.setValue(QLatin1String("targetPath"), folder.targetPath);
settings.setValue(QLatin1String("paused"), folder.paused);
settings.setValue(QLatin1String("ignoreHiddenFiles"), folder.ignoreHiddenFiles);
- settings.setValue(QLatin1String("usePlaceholders"), folder.newFilesAreVirtual);
settings.setValue(QStringLiteral("virtualFilesMode"), Vfs::modeToString(folder.virtualFilesMode));
settings.setValue(QLatin1String("navigationPaneClsid"), folder.navigationPaneClsid);
else
settings.remove(QLatin1String("navigationPaneClsid"));
- settings.endGroup();
}
bool FolderDefinition::load(QSettings &settings, const QString &alias,
FolderDefinition *folder)
{
- settings.beginGroup(alias);
folder->alias = FolderMan::unescapeAlias(alias);
folder->localPath = settings.value(QLatin1String("localPath")).toString();
folder->journalPath = settings.value(QLatin1String("journalPath")).toString();
folder->paused = settings.value(QLatin1String("paused")).toBool();
folder->ignoreHiddenFiles = settings.value(QLatin1String("ignoreHiddenFiles"), QVariant(true)).toBool();
folder->navigationPaneClsid = settings.value(QLatin1String("navigationPaneClsid")).toUuid();
- folder->newFilesAreVirtual = settings.value(QLatin1String("usePlaceholders")).toBool();
folder->virtualFilesMode = Vfs::WithSuffix;
QString vfsModeString = settings.value(QStringLiteral("virtualFilesMode")).toString();
folder->upgradeVfsMode = true;
}
- settings.endGroup();
-
// Old settings can contain paths with native separators. In the rest of the
// code we assum /, so clean it up now.
folder->localPath = prepareLocalPath(folder->localPath);
bool ignoreHiddenFiles = false;
/// Which virtual files setting the folder uses
Vfs::Mode virtualFilesMode = Vfs::Off;
- /// Whether new files are virtual
- bool newFilesAreVirtual = false;
/// The CLSID where this folder appears in registry for the Explorer navigation pane entry.
QUuid navigationPaneClsid;
/// Whether the vfs mode shall silently be updated if possible
bool upgradeVfsMode = false;
- /// Saves the folder definition, creating a new settings group.
+ /// Saves the folder definition into the current settings group.
static void save(QSettings &settings, const FolderDefinition &folder);
- /// Reads a folder definition from a settings group with the name 'alias'.
+ /// Reads a folder definition from the current settings group.
static bool load(QSettings &settings, const QString &alias,
FolderDefinition *folder);
bool supportsVirtualFiles() const;
void setSupportsVirtualFiles(bool enabled);
- /** whether new remote files shall become virtual locally */
+ /** whether new remote files shall become virtual locally
+ *
+ * This is the root folder pin state and can be overridden by explicit subfolder pin states.
+ */
bool newFilesAreVirtual() const;
void setNewFilesAreVirtual(bool enabled);
/// Reset when no follow-up is requested.
int _consecutiveFollowUpSyncs;
- SyncJournalDb _journal;
+ mutable SyncJournalDb _journal;
QScopedPointer<SyncRunFileLog> _fileLog;
settings.endGroup();
FolderDefinition folderDefinition;
+ settings.beginGroup(folderAlias);
if (FolderDefinition::load(settings, folderAlias, &folderDefinition)) {
auto defaultJournalPath = folderDefinition.defaultJournalPath(account->account());
Folder *f = addFolderInternal(std::move(folderDefinition), account.data(), std::move(vfs));
if (f) {
+ // Migrate the old "usePlaceholders" setting to the root folder pin state
+ if (settings.value(QLatin1String(versionC), 1).toInt() == 1
+ && settings.value(QLatin1String("usePlaceholders"), false).toBool()) {
+ f->setNewFilesAreVirtual(true);
+ }
+
// Migration: Mark folders that shall be saved in a backwards-compatible way
if (backwardsCompatible)
f->setSaveBackwardsCompatible(true);
if (foldersWithPlaceholders)
f->setSaveInFoldersWithPlaceholders();
+
scheduleFolder(f);
emit folderSyncStateChange(f);
}
}
+ settings.endGroup();
}
}
folderDefinition.ignoreHiddenFiles = folderMan->ignoreHiddenFiles();
if (_ocWizard->useVirtualFileSync()) {
folderDefinition.virtualFilesMode = bestAvailableVfsMode();
- if (folderDefinition.virtualFilesMode != Vfs::Off)
- folderDefinition.newFilesAreVirtual = true;
}
if (folderMan->navigationPaneHelper().showInExplorerNavigationPane())
folderDefinition.navigationPaneClsid = QUuid::createUuid();
auto f = folderMan->addFolder(account, folderDefinition);
if (f) {
+ if (folderDefinition.virtualFilesMode != Vfs::Off && _ocWizard->useVirtualFileSync())
+ f->setNewFilesAreVirtual(true);
+
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
_ocWizard->selectiveSyncBlacklist());
if (!_ocWizard->isConfirmBigFolderChecked()) {
}
// Turn new remote files into virtual files if the option is enabled.
auto &opts = _discoveryData->_syncOptions;
+ if (!directoryPinState()) {
+ dbError();
+ return;
+ }
if (!localEntry.isValid()
&& item->_type == ItemTypeFile
&& opts._vfs->mode() != Vfs::Off
- && directoryPinState() == PinState::OnlineOnly) {
+ && *directoryPinState() == PinState::OnlineOnly) {
item->_type = ItemTypeVirtualFile;
if (isVfsWithSuffix())
addVirtualFileSuffix(path._original);
return true;
}
-PinState ProcessDirectoryJob::directoryPinState()
+Optional<PinState> ProcessDirectoryJob::directoryPinState()
{
- if (_pinStateCache)
- return *_pinStateCache;
-
- // Get the path's pinstate and anchor to the root option
- _pinStateCache = _discoveryData->_statedb->pinStateForPath(_currentFolder._original.toUtf8());
- if (*_pinStateCache == PinState::Unspecified)
- _pinStateCache = _discoveryData->_syncOptions._newFilesAreVirtual ? PinState::OnlineOnly : PinState::AlwaysLocal;
-
- return *_pinStateCache;
+ if (!_pinStateCache) {
+ _pinStateCache = _discoveryData->_statedb->effectivePinStateForPath(
+ _currentFolder._original.toUtf8());
+ // don't cache db errors, just retry next time
+ }
+ return _pinStateCache;
}
bool ProcessDirectoryJob::isVfsWithSuffix() const
bool runLocalQuery();
/** Retrieve and cache directory pin state */
- PinState directoryPinState();
+ Optional<PinState> directoryPinState();
QueryMode _queryServer;
QueryMode _queryLocal;
}
auto limit = _syncOptions._newBigFolderSizeLimit;
- if (limit < 0 || (_syncOptions._vfs->mode() != Vfs::Off && _syncOptions._newFilesAreVirtual)) {
+ if (limit < 0 || _syncOptions._vfs->mode() != Vfs::Off) {
// no limit, everything is allowed;
return callback(false);
}
/** Create a virtual file for new files instead of downloading. May not be null */
QSharedPointer<Vfs> _vfs;
- /** True if new files shall be virtual */
- bool _newFilesAreVirtual = false;
-
/** The initial un-adjusted chunk size in bytes for chunked uploads, both
* for old and new chunking algorithm, which classifies the item to be chunked
*
{
auto make = [&](const QByteArray &path, PinState state) {
_db.setPinStateForPath(path, state);
+ auto pinState = _db.rawPinStateForPath(path);
+ QVERIFY(pinState);
+ QCOMPARE(*pinState, state);
};
- auto get = [&](const QByteArray &path) {
- return _db.pinStateForPath(path);
+ auto get = [&](const QByteArray &path) -> PinState {
+ auto state = _db.effectivePinStateForPath(path);
+ if (!state) {
+ QTest::qFail("couldn't read pin state", __FILE__, __LINE__);
+ return PinState::Inherited;
+ }
+ return *state;
};
// Make a thrice-nested setup
make("local", PinState::AlwaysLocal);
make("online", PinState::OnlineOnly);
- make("unspec", PinState::Unspecified);
- for (auto base : {"local/", "online/", "unspec/"}) {
- make(QByteArray(base) + "unspec", PinState::Unspecified);
+ make("inherit", PinState::Inherited);
+ for (auto base : {"local/", "online/", "inherit/"}) {
+ make(QByteArray(base) + "inherit", PinState::Inherited);
make(QByteArray(base) + "local", PinState::AlwaysLocal);
make(QByteArray(base) + "online", PinState::OnlineOnly);
- for (auto base2 : {"local/", "online/", "unspec/"}) {
- make(QByteArray(base) + base2 + "/unspec", PinState::Unspecified);
+ for (auto base2 : {"local/", "online/", "inherit/"}) {
+ make(QByteArray(base) + base2 + "/inherit", PinState::Inherited);
make(QByteArray(base) + base2 + "/local", PinState::AlwaysLocal);
make(QByteArray(base) + base2 + "/online", PinState::OnlineOnly);
}
}
- // Baseline direct checks
+ // Baseline direct checks (the fallback for unset root pinstate is AlwaysLocal)
QCOMPARE(get("local"), PinState::AlwaysLocal);
QCOMPARE(get("online"), PinState::OnlineOnly);
- QCOMPARE(get("unspec"), PinState::Unspecified);
- QCOMPARE(get("nonexistant"), PinState::Unspecified);
+ QCOMPARE(get("inherit"), PinState::AlwaysLocal);
+ QCOMPARE(get("nonexistant"), PinState::AlwaysLocal);
QCOMPARE(get("online/local"), PinState::AlwaysLocal);
QCOMPARE(get("local/online"), PinState::OnlineOnly);
- QCOMPARE(get("unspec/local"), PinState::AlwaysLocal);
- QCOMPARE(get("unspec/online"), PinState::OnlineOnly);
- QCOMPARE(get("unspec/unspec"), PinState::Unspecified);
- QCOMPARE(get("unspec/nonexistant"), PinState::Unspecified);
+ QCOMPARE(get("inherit/local"), PinState::AlwaysLocal);
+ QCOMPARE(get("inherit/online"), PinState::OnlineOnly);
+ QCOMPARE(get("inherit/inherit"), PinState::AlwaysLocal);
+ QCOMPARE(get("inherit/nonexistant"), PinState::AlwaysLocal);
// Inheriting checks, level 1
- QCOMPARE(get("local/unspec"), PinState::AlwaysLocal);
+ QCOMPARE(get("local/inherit"), PinState::AlwaysLocal);
QCOMPARE(get("local/nonexistant"), PinState::AlwaysLocal);
- QCOMPARE(get("online/unspec"), PinState::OnlineOnly);
+ QCOMPARE(get("online/inherit"), PinState::OnlineOnly);
QCOMPARE(get("online/nonexistant"), PinState::OnlineOnly);
// Inheriting checks, level 2
- QCOMPARE(get("local/unspec/unspec"), PinState::AlwaysLocal);
- QCOMPARE(get("local/local/unspec"), PinState::AlwaysLocal);
+ QCOMPARE(get("local/inherit/inherit"), PinState::AlwaysLocal);
+ QCOMPARE(get("local/local/inherit"), PinState::AlwaysLocal);
QCOMPARE(get("local/local/nonexistant"), PinState::AlwaysLocal);
- QCOMPARE(get("local/online/unspec"), PinState::OnlineOnly);
+ QCOMPARE(get("local/online/inherit"), PinState::OnlineOnly);
QCOMPARE(get("local/online/nonexistant"), PinState::OnlineOnly);
- QCOMPARE(get("online/unspec/unspec"), PinState::OnlineOnly);
- QCOMPARE(get("online/local/unspec"), PinState::AlwaysLocal);
+ QCOMPARE(get("online/inherit/inherit"), PinState::OnlineOnly);
+ QCOMPARE(get("online/local/inherit"), PinState::AlwaysLocal);
QCOMPARE(get("online/local/nonexistant"), PinState::AlwaysLocal);
- QCOMPARE(get("online/online/unspec"), PinState::OnlineOnly);
+ QCOMPARE(get("online/online/inherit"), PinState::OnlineOnly);
QCOMPARE(get("online/online/nonexistant"), PinState::OnlineOnly);
+
+ // Check changing the root pin state
+ make("", PinState::OnlineOnly);
+ QCOMPARE(get("local"), PinState::AlwaysLocal);
+ QCOMPARE(get("online"), PinState::OnlineOnly);
+ QCOMPARE(get("inherit"), PinState::OnlineOnly);
+ QCOMPARE(get("nonexistant"), PinState::OnlineOnly);
+ make("", PinState::AlwaysLocal);
+ QCOMPARE(get("local"), PinState::AlwaysLocal);
+ QCOMPARE(get("online"), PinState::OnlineOnly);
+ QCOMPARE(get("inherit"), PinState::AlwaysLocal);
+ QCOMPARE(get("nonexistant"), PinState::AlwaysLocal);
}
private:
journal.avoidReadFromDbOnNextSync(record._path);
}
-SyncOptions vfsSyncOptions()
+SyncOptions vfsSyncOptions(FakeFolder &fakeFolder)
{
SyncOptions options;
options._vfs.reset(createVfsFromPlugin(Vfs::WithSuffix).release());
- options._newFilesAreVirtual = true;
+ fakeFolder.syncJournal().setPinStateForPath("", PinState::OnlineOnly);
return options;
}
QFETCH(bool, doLocalDiscovery);
FakeFolder fakeFolder{ FileInfo() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
void testVirtualFileConflict()
{
FakeFolder fakeFolder{ FileInfo() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
void testWithNormalSync()
{
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
void testVirtualFileDownload()
{
FakeFolder fakeFolder{ FileInfo() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
void testVirtualFileDownloadResume()
{
FakeFolder fakeFolder{ FileInfo() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
void testNewFilesNotVirtual()
{
FakeFolder fakeFolder{ FileInfo() };
- SyncOptions syncOptions = vfsSyncOptions();
+ SyncOptions syncOptions = vfsSyncOptions(fakeFolder);
fakeFolder.syncEngine().setSyncOptions(syncOptions);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QVERIFY(fakeFolder.syncOnce());
QVERIFY(fakeFolder.currentLocalState().find("A/a1.nextcloud"));
- syncOptions._newFilesAreVirtual = false;
- fakeFolder.syncEngine().setSyncOptions(syncOptions);
+ fakeFolder.syncJournal().setPinStateForPath("", PinState::AlwaysLocal);
// Create a new remote file, it'll not be virtual
fakeFolder.remoteModifier().insert("A/a2");
void testDownloadRecursive()
{
FakeFolder fakeFolder{ FileInfo() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
// Create a virtual file for remote files
void testRenameToVirtual()
{
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
void testRenameVirtual()
{
FakeFolder fakeFolder{ FileInfo() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItemPtr &)));
void testSyncDehydration()
{
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
void testWipeVirtualSuffixFiles()
{
FakeFolder fakeFolder{ FileInfo{} };
- fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions());
+ fakeFolder.syncEngine().setSyncOptions(vfsSyncOptions(fakeFolder));
// Create a suffix-vfs baseline
void testNewVirtuals()
{
FakeFolder fakeFolder{ FileInfo() };
- SyncOptions syncOptions = vfsSyncOptions();
- syncOptions._newFilesAreVirtual = true;
+ SyncOptions syncOptions = vfsSyncOptions(fakeFolder);
fakeFolder.syncEngine().setSyncOptions(syncOptions);
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QVERIFY(fakeFolder.currentLocalState().find("unspec/file1.nextcloud"));
// Test 2: root is AlwaysLocal
- syncOptions._newFilesAreVirtual = false;
- fakeFolder.syncEngine().setSyncOptions(syncOptions);
+ fakeFolder.syncJournal().setPinStateForPath("", PinState::AlwaysLocal);
fakeFolder.remoteModifier().insert("file2");
fakeFolder.remoteModifier().insert("online/file2");