2 * Copyright (c) 2012 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
28 #import <Foundation/Foundation.h>
29 #import <dispatch/queue.h>
32 #import <utilities/debugging.h>
34 #import "SOSCloudKeychainConstants.h"
35 #import "SOSCloudKeychainClient.h"
37 #define XPROXYSCOPE "proxy"
39 @interface UbiqitousKVSProxy
: NSObject
41 id currentiCloudToken
;
42 CloudItemsChangedBlock itemsChangedCallback
;
45 @
property (retain
, nonatomic
) NSString
*myID
;
46 @
property (retain
, nonatomic
) NSArray
*keysToRead
;
47 @
property (retain
, nonatomic
) NSArray
*keysToWrite
;
48 @
property (retain
, nonatomic
) NSArray
*keysReadWrite
;
50 @
property (retain
, nonatomic
) NSSet
*alwaysKeys
;
51 @
property (retain
, nonatomic
) NSSet
*firstUnlockKeys
;
52 @
property (retain
, nonatomic
) NSSet
*unlockedKeys
;
53 @
property (retain
, nonatomic
) NSMutableSet
*pendingKeys
;
54 @
property (retain
, nonatomic
) NSMutableSet
*shadowPendingKeys
;
55 @
property (atomic
) bool syncWithPeersPending
;
56 @
property (atomic
) bool shadowSyncWithPeersPending
;
57 @
property (atomic
) bool inCallout
;
58 @
property (atomic
) bool unlockedSinceBoot
;
59 @
property (atomic
) bool isLocked
;
60 @
property (atomic
) bool seenKVSStoreChange
;
62 @
property (atomic
) dispatch_source_t syncTimer
;
63 @
property (atomic
) bool syncTimerScheduled
;
64 @
property (atomic
) dispatch_time_t deadline
;
65 @
property (atomic
) dispatch_time_t lastSyncTime
;
67 + (UbiqitousKVSProxy
*) sharedKVSProxy
;
68 - (NSString
*)description
;
70 - (void)streamEvent
:(xpc_object_t
)notification
;
71 - (void)setItemsChangedBlock
:(CloudItemsChangedBlock
)itemsChangedBlock
;
73 - (void)setObject
:(id
)obj forKey
:(id
)key
;
75 - (NSDictionary
*)getAll
;
76 - (void)requestSynchronization
:(bool)force
;
77 - (void)waitForSynchronization
:(NSArray
*)keys handler
:(void (^)(NSDictionary
*values
, NSError
*err
))handler
;
79 - (void)setObjectsFromDictionary
:(NSDictionary
*)values
;
80 - (void)removeObjectForKey
:(NSString
*)keyToRemove
;
81 - (void)processAllItems
;
82 - (void)requestSyncWithAllPeers
;
84 - (NSUbiquitousKeyValueStore
*)cloudStore
;
86 - (NSSet
*) keysForCurrentLockState
;
87 - (NSSet
*) filterKeySetWithLockState
: (NSSet
*) startingSet
;
88 - (NSDictionary
*)registerKeysAndGet
:(BOOL
)getNewKeysOnly always
:(NSArray
*)keysToRegister reqFirstUnlock
:(NSArray
*)reqFirstUnlock reqUnlocked
:(NSArray
*)reqUnlocked
;
90 - (NSDictionary
*)localNotification
:(NSDictionary
*)localNotificationDict outFlags
:(int64_t *)outFlags
;
91 - (void)processKeyChangedEvent
:(NSDictionary
*)keysChangedInCloud
;
92 - (NSMutableDictionary
*)copyChangedValues
:(NSSet
*)keysOfInterest
;
93 - (void)setParams
:(NSDictionary
*)paramsDict
;