/
CBLSyncConnection.h
71 lines (48 loc) · 1.86 KB
/
CBLSyncConnection.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// CBLSyncConnection.h
// Couchbase Lite
//
// Created by Jens Alfke on 4/1/15.
// Copyright (c) 2015 Couchbase. All rights reserved.
//
#import "BLIPConnection.h"
#import <CouchbaseLite/CBLDatabase.h>
#import <CouchbaseLite/CBLStatus.h>
@class CBLQueryEnumerator, CBLBlipReplicator;
typedef NS_ENUM(unsigned, SyncState) {
kSyncStopped,
kSyncConnecting,
kSyncIdle,
kSyncActive,
};
typedef CBLStatus (^OnSyncAccessCheckBlock)(BLIPRequest* req, NSString* docID);
@interface CBLSyncConnection : NSObject <BLIPConnectionDelegate>
- (instancetype) initWithDatabase: (CBLDatabase*)db
connection: (BLIPConnection*)connection
queue: (dispatch_queue_t)queue;
- (void) push: (BOOL)push pull: (BOOL)pull continuously: (BOOL)continuously;
- (void) setPushFilter: (CBLFilterBlock)filter params: (NSDictionary*)params;
- (void) setPullFilter: (NSString*)filterName params: (NSDictionary*)params;
- (void) close;
@property (weak) CBLBlipReplicator* replicator;
@property (copy) NSString* remoteCheckpointDocID;
@property (readonly) dispatch_queue_t syncQueue;
@property (readonly) NSURL* peerURL;
@property (copy) OnSyncAccessCheckBlock onSyncAccessCheck;
// The below properties are observable, but the changes happen on the syncQueue
@property (readonly) SyncState state;
@property (readonly) NSError* error;
@property (readonly) NSProgress* pullProgress;
@property (readonly, copy) NSArray* nestedPullProgress;
@property (readonly) NSProgress* pushProgress;
@property (readonly, copy) NSArray* nestedPushProgress;
#if DEBUG
@property (readonly) id lastSequence;
@property (readonly) BOOL active;
@property (readonly) BOOL savingCheckpoint; // for unit tests
#endif
@end
@interface CBLSyncConnection (PushAPI)
@property (readonly) CBLQueryEnumerator* pendingDocuments;
@end
extern NSString* const kSyncNestedProgressKey;