added iOS source code
[wl-app.git] / iOS / Pods / Realm / include / RLMSyncManager.h
1 ////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright 2016 Realm Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 ////////////////////////////////////////////////////////////////////////////
18
19 #import <Foundation/Foundation.h>
20
21 #import "RLMSyncUtil.h"
22
23 @class RLMSyncSession;
24
25 /// An enum representing different levels of sync-related logging that can be configured.
26 typedef NS_ENUM(NSUInteger, RLMSyncLogLevel) {
27     /// Nothing will ever be logged.
28     RLMSyncLogLevelOff,
29     /// Only fatal errors will be logged.
30     RLMSyncLogLevelFatal,
31     /// Only errors will be logged.
32     RLMSyncLogLevelError,
33     /// Warnings and errors will be logged.
34     RLMSyncLogLevelWarn,
35     /// Information about sync events will be logged. Fewer events will be logged in order to avoid overhead.
36     RLMSyncLogLevelInfo,
37     /// Information about sync events will be logged. More events will be logged than with `RLMSyncLogLevelInfo`.
38     RLMSyncLogLevelDetail,
39     /// Log information that can aid in debugging.
40     ///
41     /// - warning: Will incur a measurable performance impact.
42     RLMSyncLogLevelDebug,
43     /// Log information that can aid in debugging. More events will be logged than with `RLMSyncLogLevelDebug`.
44     ///
45     /// - warning: Will incur a measurable performance impact.
46     RLMSyncLogLevelTrace,
47     /// Log information that can aid in debugging. More events will be logged than with `RLMSyncLogLevelTrace`.
48     ///
49     /// - warning: Will incur a measurable performance impact.
50     RLMSyncLogLevelAll
51 };
52
53 NS_ASSUME_NONNULL_BEGIN
54
55 /// A block type representing a block which can be used to report a sync-related error to the application. If the error
56 /// pertains to a specific session, that session will also be passed into the block.
57 typedef void(^RLMSyncErrorReportingBlock)(NSError *, RLMSyncSession * _Nullable);
58
59 /**
60  A singleton manager which serves as a central point for sync-related configuration.
61  */
62 @interface RLMSyncManager : NSObject
63
64 /**
65  A block which can optionally be set to report sync-related errors to your application.
66
67  Any error reported through this block will be of the `RLMSyncError` type, and marked
68  with the `RLMSyncErrorDomain` domain.
69
70  Errors reported through this mechanism are fatal, with several exceptions. Please consult
71  `RLMSyncError` for information about the types of errors that can be reported through
72  the block, and for for suggestions on handling recoverable error codes.
73
74  @see `RLMSyncError`
75  */
76 @property (nullable, nonatomic, copy) RLMSyncErrorReportingBlock errorHandler;
77
78 /**
79  A reverse-DNS string uniquely identifying this application. In most cases this is automatically set by the SDK, and
80  does not have to be explicitly configured.
81  */
82 @property (nonatomic, copy) NSString *appID;
83
84 /**
85  The logging threshold which newly opened synced Realms will use. Defaults to
86  `RLMSyncLogLevelInfo`.
87
88  Logging strings are output to Apple System Logger.
89
90  @warning This property must be set before any synced Realms are opened. Setting it after
91           opening any synced Realm will do nothing.
92  */
93 @property (nonatomic) RLMSyncLogLevel logLevel;
94
95 /// The sole instance of the singleton.
96 + (instancetype)sharedManager NS_REFINED_FOR_SWIFT;
97
98 /// :nodoc:
99 - (instancetype)init __attribute__((unavailable("RLMSyncManager cannot be created directly")));
100
101 /// :nodoc:
102 + (instancetype)new __attribute__((unavailable("RLMSyncManager cannot be created directly")));
103
104 NS_ASSUME_NONNULL_END
105
106 @end