ECSyncSettings.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef ECSYNCSETTINGS_INCLUDED
  18. #define ECSYNCSETTINGS_INCLUDED
  19. #include <mutex>
  20. #include <kopano/zcdefs.h>
  21. namespace KC {
  22. #define EC_SYNC_OPT_STREAM 1
  23. #define EC_SYNC_OPT_CHANGENOTIF 2
  24. #define EC_SYNC_OPT_STATECOLLECT 4
  25. #define EC_SYNC_OPT_CONTINUOUS 8 // Not included in EC_SYNC_OPT_ALL
  26. #define EC_SYNC_OPT_ALL (EC_SYNC_OPT_STREAM | EC_SYNC_OPT_CHANGENOTIF | EC_SYNC_OPT_STATECOLLECT)
  27. class _kc_export ECSyncSettings _kc_final {
  28. public:
  29. static ECSyncSettings* GetInstance();
  30. // Synclog settings
  31. bool SyncLogEnabled() const;
  32. ULONG SyncLogLevel() const;
  33. bool ContinuousLogging() const;
  34. // Sync options
  35. bool SyncStreamEnabled() const;
  36. bool ChangeNotificationsEnabled() const;
  37. bool StateCollectorEnabled() const;
  38. // Stream settings
  39. ULONG StreamTimeout() const;
  40. ULONG StreamBufferSize() const;
  41. ULONG StreamBatchSize() const;
  42. // Update settings
  43. bool EnableSyncLog(bool bEnable);
  44. ULONG SetSyncLogLevel(ULONG ulLogLevel);
  45. ULONG SetSyncOptions(ULONG ulOptions);
  46. ULONG SetStreamTimeout(ULONG ulTimeout);
  47. ULONG SetStreamBufferSize(ULONG ulBufferSize);
  48. ULONG SetStreamBatchSize(ULONG ulBatchSize);
  49. private:
  50. _kc_hidden ECSyncSettings(void);
  51. ULONG m_ulSyncLog = 0, m_ulSyncLogLevel;
  52. ULONG m_ulSyncOpts = EC_SYNC_OPT_ALL, m_ulStreamTimeout = 30000;
  53. ULONG m_ulStreamBufferSize = 131072, m_ulStreamBatchSize = 256;
  54. static std::mutex s_hMutex;
  55. static ECSyncSettings *s_lpInstance;
  56. struct _kc_hidden __initializer {
  57. ~__initializer();
  58. };
  59. static __initializer __i;
  60. };
  61. } /* namespace */
  62. #endif // ndef ECSYNCSETTINGS_INCLUDED