@@ -35,16 +35,22 @@ NS_ASSUME_NONNULL_BEGIN
3535/* * Replicator Configuration */
3636@interface CBLReplicatorConfiguration : NSObject
3737
38- /* * The local database to replicate with the target endpoint. */
39-
38+ /* *
39+ The local database to replicate with the target endpoint.
40+ */
4041@property (nonatomic , readonly ) CBLDatabase* database
41- __deprecated_msg (" Use config.collections instead" );
42+ __deprecated_msg (" Use collectionConfigs instead" );
4243
4344/* *
4445 The replication endpoint to replicate with.
4546 */
4647@property (nonatomic , readonly ) id <CBLEndpoint> target;
4748
49+ /* *
50+ The collection configurations used for the replication. Each configuration specifies a collection and its configuration.
51+ */
52+ @property (nonatomic , readonly ) NSArray <CBLCollectionConfiguration*>* collectionConfigs;
53+
4854/* *
4955 Replication type indicating the direction of the replication. The default value is
5056 .pushAndPull which is bidrectional.
@@ -94,46 +100,37 @@ __deprecated_msg(" Use config.collections instead");
94100@property (nonatomic ) BOOL acceptParentDomainCookies;
95101
96102/* *
97- Channels filter when using init(database:target:) to configure the default collection
98- for the replication.
103+ A set of Sync Gateway channel names to pull from for the default collection. Ignored for push replication.
99104
100105 @Note: Channels are not supported in Peer-to-Peer and Database-to-Database replication.
101106 */
102107@property (nonatomic , nullable ) NSArray <NSString*>* channels
103- __deprecated_msg (" Use [... initWithTarget:] and [config addCollection: config:]" \
104- " with a CBLCollectionConfiguration object instead" );
108+ __deprecated_msg (" Use -initWithCollections:target: instead." );
105109
106110/* *
107- documentIDs filter when using init(database:target:) to configure the default collection
108- for the replication.
111+ A set of document IDs to filter by for the default collection. If given, only documents with these IDs will be pushed and/or pulled.
109112 */
110113@property (nonatomic , nullable ) NSArray <NSString*>* documentIDs
111- __deprecated_msg (" Use [... initWithTarget:] and [config addCollection: config:]" \
112- " with a CBLCollectionConfiguration object instead" );
114+ __deprecated_msg (" Use -initWithCollections:target: instead." );
113115
114116/* *
115- Push filter when using init(database:target:) to configure the default collection
116- for the replication.
117+ A push filter for the default collection. Only documents for which the filter returns true are replicated.
117118 */
118119@property (nonatomic , nullable ) CBLReplicationFilter pushFilter
119- __deprecated_msg (" Use [... initWithTarget:] and [config addCollection: config:]" \
120- " with a CBLCollectionConfiguration object instead" );
120+ __deprecated_msg (" Use -initWithCollections:target: instead." );
121121
122122/* *
123- Pull filter when using init(database:target:) to configure the default collection
124- for the replication.
123+ A pull filter for the default collection. Only documents for which the closure returns true are replicated.
125124 */
126125@property (nonatomic , nullable ) CBLReplicationFilter pullFilter
127- __deprecated_msg (" Use [... initWithTarget:] and [config addCollection: config:]" \
128- " with a CBLCollectionConfiguration object instead" );
126+ __deprecated_msg (" Use -initWithCollections:target: instead." );
129127
130128/* *
131- Conflict resolver when using init(database:target:) to configure the default collection
132- for the replication .
129+ The custom conflict resolver for the default collection. If this value is not set, or set to nil,
130+ the default conflict resolver will be applied .
133131 */
134132@property (nonatomic , nullable ) id <CBLConflictResolver> conflictResolver
135- __deprecated_msg (" Use [... initWithTarget:] and [config addCollection: config:]" \
136- " with a CBLCollectionConfiguration object instead" );
133+ __deprecated_msg (" Use -initWithCollections:target: instead." );
137134
138135#if TARGET_OS_IPHONE
139136/* *
@@ -200,26 +197,35 @@ __deprecated_msg(" Use [... initWithTarget:] and [config addCollection: config:]
200197 */
201198@property (nonatomic ) BOOL enableAutoPurge;
202199
203- /* * The collections used for the replication. */
204- @property (nonatomic , readonly ) NSArray <CBLCollection*>* collections;
200+ /* *
201+ The collections used for the replication.
202+ */
203+ @property (nonatomic , readonly ) NSArray <CBLCollection*>* collections
204+ __deprecated_msg (" Use collectionConfigs instead." );
205205
206206/* * Not available */
207207- (instancetype ) init NS_UNAVAILABLE;
208208
209209/* *
210- Initializes a CBLReplicatorConfiguration with the local database and
211- the target endpoint.
210+ Initializes a CBLReplicatorConfiguration with the given database and the target's endpoint.
211+
212+ When using this initializer, the default collection of the given database will be automatically
213+ included in the configuration.
214+
215+ If you do not intend to replicate the default collection, use -initWithCollections:target: instead to
216+ explicity specifiy the intended collections.
212217
213218 @param database The database.
214219 @param target The target endpoint.
215220 @return The CBLReplicatorConfiguration object.
216221 */
217222- (instancetype ) initWithDatabase : (CBLDatabase*)database
218223 target : (id <CBLEndpoint>)target
219- __deprecated_msg(" Use [... initWithTarget:] instead." );
224+ __deprecated_msg(" Use -initWithCollections:target: instead." );
220225
221226/* *
222- Create a ReplicatorConfiguration object with the target’s endpoint.
227+ Initializes a CBLReplicatorConfiguration with the target’s endpoint.
228+
223229 After the ReplicatorConfiguration object is created, use addCollection(_ collection:, config:)
224230 or addCollections(_ collections:, config:) to specify and configure the collections used for
225231 replicating with the target. If there are no collections specified, the replicator will fail
@@ -228,7 +234,19 @@ __deprecated_msg("Use [... initWithTarget:] instead.");
228234 @param target The target endpoint.
229235 @return The CBLReplicatorConfiguration object.
230236 */
231- - (instancetype ) initWithTarget : (id <CBLEndpoint>)target ;
237+ - (instancetype ) initWithTarget : (id <CBLEndpoint>)target
238+ __deprecated_msg(" Use -initWithCollections:target: instead." );
239+
240+ /* *
241+ Initializes a CBLReplicatorConfiguration with the specified collection configurations and target's endpoint.
242+
243+ Each `CBLCollectionConfiguration` in the `collections` array must be initialized using `-initWithCollection:`.
244+
245+ @param collections An array of collection configurations to replicate.
246+ @param target The target endpoint.
247+ */
248+ - (instancetype ) initWithCollections : (NSArray <CBLCollectionConfiguration*>*)collections
249+ target : (id <CBLEndpoint>)target ;
232250
233251/* *
234252 Initializes a CBLReplicatorConfiguration with the configuration object.
@@ -245,9 +263,11 @@ __deprecated_msg("Use [... initWithTarget:] instead.");
245263 If a null configuration is specified, a default empty configuration will be applied.
246264
247265 @param collection The collection to be added.
248- @param config Configuration for the collection, if nil, default config */
266+ @param config Configuration for the collection, if nil, default config
267+ */
249268- (void ) addCollection : (CBLCollection*)collection
250- config : (nullable CBLCollectionConfiguration*)config ;
269+ config : (nullable CBLCollectionConfiguration*)config
270+ __deprecated_msg(" Use -initWithCollections:target: instead." );
251271
252272/* *
253273 Add multiple collections used for the replication with an optional shared collection configuration.
@@ -258,23 +278,29 @@ __deprecated_msg("Use [... initWithTarget:] instead.");
258278 If a null configuration is specified, a default empty configuration will be applied.
259279
260280 @param collections The collections to be added.
261- @param config Respective configuration for the collections, if nil, default config */
281+ @param config Respective configuration for the collections, if nil, default config
282+ */
262283- (void ) addCollections : (NSArray *)collections
263- config : (nullable CBLCollectionConfiguration*)config ;
284+ config : (nullable CBLCollectionConfiguration*)config
285+ __deprecated_msg(" Use -initWithCollections:target: instead." );
264286
265287/* *
266288 Remove the collection. If the collection doesn’t exist, this operation will be no ops.
267289
268- @param collection The collection to be removed. */
269- - (void ) removeCollection : (CBLCollection*)collection ;
290+ @param collection The collection to be removed.
291+ */
292+ - (void ) removeCollection : (CBLCollection*)collection
293+ __deprecated_msg(" Use -initWithCollections:target: instead." );
270294
271295/* *
272296 Get a copy of the collection’s config. If the config needs to be changed for the collection, the
273297 collection will need to be re-added with the updated config.
274298
275299 @param collection The collection whose config is needed.
276- @return The collection configuration, or nil if config doesn't exist */
277- - (nullable CBLCollectionConfiguration*) collectionConfig : (CBLCollection*)collection ;
300+ @return The collection configuration, or nil if config doesn't exist
301+ */
302+ - (nullable CBLCollectionConfiguration*) collectionConfig : (CBLCollection*)collection
303+ __deprecated_msg(" Use collectionConfigs instead." );
278304
279305@end
280306
0 commit comments