diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-12-05 18:54:02 +0300 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2017-12-07 19:35:38 +0300 |
commit | 7230fa6b4fb0d077bc82814074aeb853ed45345f (patch) | |
tree | ca7b2eb05525bcbe4b76449b39a409b5c65df61b | |
parent | e25af4f0dc2584d7478c2feedb8e14c46fdee44d (diff) |
SyncOptions: move to its own file
It does not really belong in the discoveryphase.h as it is used also for
propagator option.
Also use C++11 style member initializer
-rw-r--r-- | src/libsync/discoveryphase.h | 47 | ||||
-rw-r--r-- | src/libsync/owncloudpropagator.h | 2 | ||||
-rw-r--r-- | src/libsync/syncoptions.h | 61 |
3 files changed, 63 insertions, 47 deletions
diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index eea33ad52..222f4a999 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -24,6 +24,7 @@ #include <QWaitCondition> #include <QLinkedList> #include <deque> +#include "syncoptions.h" namespace OCC { @@ -35,52 +36,6 @@ class Account; * if the files are new, or changed. */ -struct SyncOptions -{ - SyncOptions() - : _newBigFolderSizeLimit(-1) - , _confirmExternalStorage(false) - , _initialChunkSize(10 * 1000 * 1000) // 10 MB - , _minChunkSize(1 * 1000 * 1000) // 1 MB - , _maxChunkSize(100 * 1000 * 1000) // 100 MB - , _targetChunkUploadDuration(60 * 1000) // 1 minute - , _parallelNetworkJobs(true) - { - } - - /** Maximum size (in Bytes) a folder can have without asking for confirmation. - * -1 means infinite */ - qint64 _newBigFolderSizeLimit; - - /** If a confirmation should be asked for external storages */ - bool _confirmExternalStorage; - - /** 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 - * - * In chunkingNG, when dynamic chunk size adjustments are done, this is the - * starting value and is then gradually adjusted within the - * minChunkSize / maxChunkSize bounds. - */ - quint64 _initialChunkSize; - - /** The minimum chunk size in bytes for chunked uploads */ - quint64 _minChunkSize; - - /** The maximum chunk size in bytes for chunked uploads */ - quint64 _maxChunkSize; - - /** The target duration of chunk uploads for dynamic chunk sizing. - * - * Set to 0 it will disable dynamic chunk sizing. - */ - quint64 _targetChunkUploadDuration; - - /** Whether parallel network jobs are allowed. */ - bool _parallelNetworkJobs; -}; - - struct DiscoveryDirectoryResult { QString path; diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index 9655e1ac4..efc7c01dd 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -30,7 +30,7 @@ #include "common/syncjournaldb.h" #include "bandwidthmanager.h" #include "accountfwd.h" -#include "discoveryphase.h" +#include "syncoptions.h" namespace OCC { diff --git a/src/libsync/syncoptions.h b/src/libsync/syncoptions.h new file mode 100644 index 000000000..f6565584c --- /dev/null +++ b/src/libsync/syncoptions.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) by Olivier Goffart <ogoffart@woboq.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License + * for more details. + */ + +#pragma once + +#include "owncloudlib.h" +#include <QString> + + +namespace OCC { + +/** + * Value class containing the options given to the sync engine + */ +struct SyncOptions +{ + /** Maximum size (in Bytes) a folder can have without asking for confirmation. + * -1 means infinite */ + qint64 _newBigFolderSizeLimit = -1; + + /** If a confirmation should be asked for external storages */ + bool _confirmExternalStorage = 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 + * + * In chunkingNG, when dynamic chunk size adjustments are done, this is the + * starting value and is then gradually adjusted within the + * minChunkSize / maxChunkSize bounds. + */ + quint64 _initialChunkSize = 10 * 1000 * 1000; // 10MB + + /** The minimum chunk size in bytes for chunked uploads */ + quint64 _minChunkSize = 1 * 1000 * 1000; // 1MB + + /** The maximum chunk size in bytes for chunked uploads */ + quint64 _maxChunkSize = 100 * 1000 * 1000; // 100MB + + /** The target duration of chunk uploads for dynamic chunk sizing. + * + * Set to 0 it will disable dynamic chunk sizing. + */ + quint64 _targetChunkUploadDuration = 60 * 1000; // 1 minute + + /** Whether parallel network jobs are allowed. */ + bool _parallelNetworkJobs = true; +}; + + +} |