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 {
27 if ((self = [super init])) {
29 self.data = [NSMutableDictionary<NSString*, NSObject*> dictionary];
34 - (void) connectToProxy: (UbiqitousKVSProxy*) proxy {
38 - (void)setObject:(id)obj forKey:(NSString*)key {
39 [self.data setValue: obj forKey: key];
42 - (NSDictionary<NSString *, id>*) copyAsDictionary {
46 - (void)addEntriesFromDictionary:(NSDictionary<NSString*, NSObject*> *)otherDictionary {
47 [otherDictionary enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSObject * _Nonnull obj, BOOL * _Nonnull stop) {
48 [self setObject:obj forKey:key];
52 - (id)objectForKey:(NSString*)key {
53 return [self.data objectForKey:key];
56 - (void)removeObjectForKey:(NSString*)key {
57 return [self.data removeObjectForKey:key];
60 - (void)removeAllObjects {
61 [self.data removeAllObjects];
64 - (void)pushWrites:(NSArray<NSString*>*)keys requiresForceSync:(BOOL)requiresForceSync
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