]> git.saurik.com Git - apple/security.git/blob - sec/SOSCircle/Regressions/CKDKeyValueStore.h
Security-55471.14.18.tar.gz
[apple/security.git] / sec / SOSCircle / Regressions / CKDKeyValueStore.h
1 //
2 // CKDKeyValueStore.h
3 // sec
4 //
5 // Created by John Hurley on 9/9/12.
6 //
7 //
8
9 #import <Foundation/Foundation.h>
10 //#import "CKDKVSProxy.h"
11 #import "SOSCloudKeychainConstants.h"
12 #import "SOSCloudKeychainClient.h"
13
14 extern CFStringRef kCKDKVSRemoteStoreID;
15 extern CFStringRef kCKDAWSRemoteStoreID;
16
17 //--- protocol ---
18
19 @protocol CKDKVSDelegate <NSObject>
20
21 @required
22
23 - (id)objectForKey:(NSString *)aKey;
24 - (void)setObject:(id)anObject forKey:(NSString *)aKey;
25 - (void)removeObjectForKey:(NSString *)aKey;
26
27 - (NSDictionary *)dictionaryRepresentation;
28
29 - (BOOL)synchronize;
30
31 @optional
32 - (BOOL)isLocalKVS;
33 // DEBUG
34 - (void)setDictionaryRepresentation:(NSMutableDictionary *)initialValue;
35 - (void)clearPersistentStores;
36
37 @end
38
39 //--- interface ---
40
41 @interface CKDKeyValueStore : NSObject <CKDKVSDelegate>
42 {
43 BOOL localKVS;
44 BOOL persistStore;
45 CloudItemsChangedBlock itemsChangedCallback;
46 }
47
48 @property (retain) id <CKDKVSDelegate> delegate;
49 @property (retain) NSString *identifier;
50 @property (retain) NSString *path;
51
52 - (BOOL)synchronize;
53 + (CKDKeyValueStore *)defaultStore:(NSString *)identifier itemsChangedBlock:(CloudItemsChangedBlock)itemsChangedBlock;
54 - (id)initWithIdentifier:(NSString *)xidentifier itemsChangedBlock:(CloudItemsChangedBlock)itemsChangedBlock;
55
56 + (CFStringRef)remoteStoreID;
57
58 - (id)initWithItemsChangedBlock:(CloudItemsChangedBlock)itemsChangedBlock;
59 - (void)cloudChanged:(NSNotification*)notification;
60
61 @end
62
63 @interface CKDKeyValueStoreCollection : NSObject
64 {
65 dispatch_queue_t syncrequestqueue;
66 NSMutableDictionary *store;
67 }
68 @property (retain) NSMutableDictionary *collection;
69
70 + (id)sharedInstance;
71 + (id <CKDKVSDelegate>)defaultStore:(NSString *)identifier itemsChangedBlock:(CloudItemsChangedBlock)itemsChangedBlock;
72 + (void)enqueueWrite:(id)anObject forKey:(NSString *)aKey from:(NSString *)identifier;
73 + (id)enqueueWithReply:(NSString *)aKey;
74 + (BOOL)enqueueSyncWithReply;
75 + (void)postItemChangedNotification:(NSString *)keyThatChanged from:(NSString *)identifier;
76 + (void)postItemsChangedNotification:(NSArray *)keysThatChanged from:(NSString *)identifier;
77
78 @end