added iOS source code
[wl-app.git] / iOS / Pods / Realm / include / core / realm / sync / server_configuration.hpp
1 /*************************************************************************
2  *
3  * REALM CONFIDENTIAL
4  * __________________
5  *
6  *  [2011] - [2015] Realm Inc
7  *  All Rights Reserved.
8  *
9  * NOTICE:  All information contained herein is, and remains
10  * the property of Realm Incorporated and its suppliers,
11  * if any.  The intellectual and technical concepts contained
12  * herein are proprietary to Realm Incorporated
13  * and its suppliers and may be covered by U.S. and Foreign Patents,
14  * patents in process, and are protected by trade secret or copyright law.
15  * Dissemination of this information or reproduction of this material
16  * is strictly forbidden unless prior written permission is obtained
17  * from Realm Incorporated.
18  *
19  **************************************************************************/
20 #ifndef REALM_SYNC_SERVER_CONFIGURATION_HPP
21 #define REALM_SYNC_SERVER_CONFIGURATION_HPP
22
23 #include <vector>
24
25 // Realm headers
26 #include <realm/util/logger.hpp>
27 #include <realm/util/optional.hpp>
28 #include <realm/sync/server.hpp>
29
30 namespace realm {
31 namespace config {
32
33 struct Configuration {
34     std::string id = "";
35     std::string listen_address = "127.0.0.1";
36     std::string listen_port = ""; // Empty means choose default based on `ssl`.
37     realm::util::Optional<std::string> root_dir;
38     std::string user_data_dir;
39     realm::util::Optional<std::string> public_key_path;
40     realm::util::Optional<std::string> config_file_path;
41     bool reuse_address = true;
42     bool disable_sync = false;
43     realm::util::Logger::Level log_level = realm::util::Logger::Level::info;
44     realm::util::Optional<std::string> log_path;
45     long max_open_files = 256;
46     bool ssl = false;
47     std::string ssl_certificate_path;
48     std::string ssl_certificate_key_path;
49     std::string dashboard_stats_endpoint = "localhost:28125";
50     uint_fast64_t drop_period_s = 60; // 1 minute
51     uint_fast64_t idle_timeout_s = 1800; // 30 minutes
52     realm::sync::Server::Config::OperatingMode operating_mode =
53        realm::sync::Server::Config::OperatingMode::MasterWithNoSlave;
54     std::string master_address;
55     std::string master_port;
56     bool master_slave_ssl = false;
57     bool master_verify_ssl_certificate = true;
58     util::Optional<std::string> master_ssl_trust_certificate_path;
59     std::string master_slave_shared_secret;
60     util::Optional<std::string> feature_token;
61     util::Optional<std::string> feature_token_path;
62     bool enable_download_log_compaction = true;
63     size_t max_download_size = 0x20000; // 128 KiB
64 };
65
66 #if !REALM_MOBILE
67 void show_help(const std::string& program_name);
68 Configuration build_configuration(int argc, char* argv[]);
69 #endif
70 Configuration load_configuration(std::string configuration_file_path);
71
72 } // namespace config
73
74
75 namespace sync {
76
77 /// Initialise the directory structure as required (create missing directory
78 /// structure) for correct operation of the server. This function is supposed to
79 /// be executed prior to instantiating the \c Server object.
80 ///
81 /// Note: This function also handles migration of server-side Realm files from
82 /// the legacy format (see _impl::ensure_legacy_migration_1()).
83 ///
84 /// The type of migration performed by this function is nonatomic, and it
85 /// therefore requires that no other thread or process has any of the servers
86 /// Realm files open concurrently. The application is advised to make sure that
87 /// all agents (including the sync server), that might open server-side Realm
88 /// files are not started until after this function has completed sucessfully.
89 void prepare_server_directory(const config::Configuration&, util::Logger&);
90
91 } // namespace sync
92 } // namespace realm
93
94 #endif // REALM_SYNC_SERVER_CONFIGURATION_HPP