6 #import "CKDSimulatedStore.h"
7 #import "CKDKVSProxy.h"
9 #include "SOSCloudKeychainConstants.h"
10 #include <utilities/debugging.h>
12 #import "SyncedDefaults/SYDConstants.h"
13 #include <os/activity.h>
15 @interface CKDSimulatedStore ()
16 @property (readwrite, weak) UbiqitousKVSProxy* proxy;
17 @property (readwrite) NSMutableDictionary<NSString*, NSObject*>* data;
20 @implementation CKDSimulatedStore
22 + (instancetype)simulatedInterface {
23 return [[CKDSimulatedStore alloc] init];
26 - (instancetype)init {
30 self.data = [NSMutableDictionary<NSString*, NSObject*> dictionary];
35 - (void) connectToProxy: (UbiqitousKVSProxy*) proxy {
39 - (void)setObject:(id)obj forKey:(NSString*)key {
40 [self.data setValue: obj forKey: key];
43 - (NSDictionary<NSString *, id>*) copyAsDictionary {
47 - (void)addEntriesFromDictionary:(NSDictionary<NSString*, NSObject*> *)otherDictionary {
48 [otherDictionary enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSObject * _Nonnull obj, BOOL * _Nonnull stop) {
49 [self setObject:obj forKey:key];
53 - (id)objectForKey:(NSString*)key {
54 return [self.data objectForKey:key];
57 - (void)removeObjectForKey:(NSString*)key {
58 return [self.data removeObjectForKey:key];
61 - (void)removeAllObjects {
62 [self.data removeAllObjects];
68 - (void)addOneToOutGoing{
71 - (BOOL) pullUpdates:(NSError **)failure
76 - (void)remoteSetObject:(id)obj forKey:(NSString*)key
78 [self.data setObject:obj forKey:key];
80 [self.proxy storeKeysChanged: [NSSet setWithObject:key] initial: NO];
83 - (void)perfCounters:(void(^)(NSDictionary *counters))callback