]>
Commit | Line | Data |
---|---|---|
b54c578e A |
1 | #if OCTAGON |
2 | ||
3 | #import <CloudKit/CloudKit.h> | |
4 | #import <Foundation/Foundation.h> | |
5 | ||
6 | #import "keychain/ckks/CKKSNearFutureScheduler.h" | |
7 | #import "keychain/ckks/CKKSReachabilityTracker.h" | |
8 | #import "keychain/ckks/CKKSResultOperation.h" | |
9 | #import "keychain/ckks/CKKSCloudKitClassDependencies.h" | |
10 | ||
11 | NS_ASSUME_NONNULL_BEGIN | |
12 | ||
13 | @interface CKKSZoneModifyOperations : NSObject | |
14 | @property CKKSResultOperation* zoneModificationOperation; | |
15 | @property CKKSResultOperation* zoneSubscriptionOperation; | |
16 | ||
17 | @property (readonly) NSMutableArray<CKRecordZone*>* zonesToCreate; | |
18 | @property (readonly) NSMutableArray<CKRecordZoneSubscription*>* subscriptionsToSubscribe; | |
19 | @property (readonly) NSMutableArray<CKRecordZoneID*>* zoneIDsToDelete; | |
20 | ||
21 | - (instancetype)init NS_UNAVAILABLE; | |
22 | ||
23 | // After the operations run, these properties will be filled in: | |
24 | // Note that your zone may or may not succeed even if the whole operation fails | |
25 | @property (nullable) NSArray<CKRecordZone*>* savedRecordZones; | |
26 | @property (nullable) NSArray<CKRecordZoneID*>* deletedRecordZoneIDs; | |
27 | // The error from the zone modifcation, if any, will be on the zoneModificationOperation | |
28 | ||
29 | @property (nullable) NSArray<CKSubscription*>* savedSubscriptions; | |
30 | @property (nullable) NSArray<NSString*>* deletedSubscriptionIDs; | |
31 | // The error from the zone subscription, if any, will be on the zoneSubscriptionOperation | |
32 | @end | |
33 | ||
34 | ||
35 | @interface CKKSZoneModifier : NSObject | |
36 | @property (readonly) CKKSReachabilityTracker* reachabilityTracker; | |
37 | @property (readonly) CKKSCloudKitClassDependencies* cloudKitClassDependencies; | |
38 | @property (readonly) CKContainer* container; | |
39 | @property (readonly) CKDatabase* database; | |
40 | ||
41 | // Block on this to schedule operations for directly after a CloudKit retryAfter delay expires | |
42 | @property (readonly) CKKSNearFutureScheduler* cloudkitRetryAfter; | |
43 | ||
44 | // Send every CK error here: it will update the cloudkitRetryAfter scheduler | |
45 | - (void)inspectErrorForRetryAfter:(NSError*)ckerror; | |
46 | ||
47 | - (instancetype)init NS_UNAVAILABLE; | |
48 | - (instancetype)initWithContainer:(CKContainer*)container | |
49 | reachabilityTracker:(CKKSReachabilityTracker*)reachabilityTracker | |
50 | cloudkitDependencies:(CKKSCloudKitClassDependencies*)_cloudKitClassDependencies; | |
51 | ||
52 | - (CKKSZoneModifyOperations*)createZone:(CKRecordZone*)zone; | |
53 | ||
54 | // Note that on a zone delete, we do not run the subscription operation | |
55 | // It may or may not run, depending on if any other zone creations have been requested | |
56 | - (CKKSZoneModifyOperations*)deleteZone:(CKRecordZoneID*)zoneID; | |
57 | ||
58 | // For tests only | |
59 | - (void)halt; | |
60 | ||
61 | @end | |
62 | ||
63 | NS_ASSUME_NONNULL_END | |
64 | ||
65 | #endif |