@@ -44,37 +44,37 @@ BOOL canBeRepresentedAsLong(NSNumber *num) {
44
44
// hit, we wrap around existing data of either snapshot or CompoundWrite
45
45
// (allowing us to share code) and read from the CompoundWrite only when/where
46
46
// we need to calculate an incremented value's prior state.
47
- @protocol JITExistingValue <NSObject >
48
- - (id <JITExistingValue >)getChild : (NSString *)pathSegment ;
47
+ @protocol ValueProvider <NSObject >
48
+ - (id <ValueProvider >)getChild : (NSString *)pathSegment ;
49
49
- (id <FNode>)value ;
50
50
@end
51
51
52
- @interface JITExistingValueSyncTree : NSObject <JITExistingValue >
52
+ @interface DeferredValueProvider : NSObject <ValueProvider >
53
53
- (instancetype )initWithSyncTree : (FSyncTree *)tree atPath : (FPath *)path ;
54
- - (id <JITExistingValue >)getChild : (NSString *)pathSegment ;
54
+ - (id <ValueProvider >)getChild : (NSString *)pathSegment ;
55
55
- (id <FNode>)value ;
56
56
@property FPath *path;
57
57
@property FSyncTree *tree;
58
58
@end
59
59
60
- @interface JITExistingValueSnapshot : NSObject <JITExistingValue >
60
+ @interface ExistingValueProvider : NSObject <ValueProvider >
61
61
- (instancetype )initWithSnapshot : (id <FNode>)snapshot ;
62
- - (id <JITExistingValue >)getChild : (NSString *)pathSegment ;
62
+ - (id <ValueProvider >)getChild : (NSString *)pathSegment ;
63
63
- (id <FNode>)value ;
64
64
@property id <FNode> snapshot;
65
65
@end
66
66
67
- @implementation JITExistingValueSyncTree
67
+ @implementation DeferredValueProvider
68
68
- (instancetype )initWithSyncTree : (FSyncTree *)tree atPath : (FPath *)path {
69
69
self.tree = tree;
70
70
self.path = path;
71
71
return self;
72
72
}
73
73
74
- - (id <JITExistingValue >)getChild : (NSString *)pathSegment {
74
+ - (id <ValueProvider >)getChild : (NSString *)pathSegment {
75
75
FPath *child = [self .path childFromString: pathSegment];
76
- return [[JITExistingValueSyncTree alloc ] initWithSyncTree: self .tree
77
- atPath: child];
76
+ return [[DeferredValueProvider alloc ] initWithSyncTree: self .tree
77
+ atPath: child];
78
78
}
79
79
80
80
- (id <FNode>)value {
@@ -83,14 +83,14 @@ - (instancetype)initWithSyncTree:(FSyncTree *)tree atPath:(FPath *)path {
83
83
}
84
84
@end
85
85
86
- @implementation JITExistingValueSnapshot
86
+ @implementation ExistingValueProvider
87
87
- (instancetype )initWithSnapshot : (id <FNode>)snapshot {
88
88
self.snapshot = snapshot;
89
89
return self;
90
90
}
91
91
92
- - (id <JITExistingValue >)getChild : (NSString *)pathSegment {
93
- return [[JITExistingValueSnapshot alloc ]
92
+ - (id <ValueProvider >)getChild : (NSString *)pathSegment {
93
+ return [[ExistingValueProvider alloc ]
94
94
initWithSnapshot: [self .snapshot getImmediateChild: pathSegment]];
95
95
}
96
96
@@ -103,10 +103,10 @@ @interface FServerValues ()
103
103
+ (id )resolveScalarServerOp : (NSString *)op
104
104
withServerValues : (NSDictionary *)serverValues ;
105
105
+ (id )resolveComplexServerOp : (NSDictionary *)op
106
- withExisting : (id <JITExistingValue >)existing
106
+ withExisting : (id <ValueProvider >)existing
107
107
serverValues : (NSDictionary *)serverValues ;
108
108
+ (id <FNode>)resolveDeferredValueSnapshot : (id <FNode>)node
109
- withJITExisting : (id <JITExistingValue >)existing
109
+ withJITExisting : (id <ValueProvider >)existing
110
110
serverValues : (NSDictionary *)serverValues ;
111
111
112
112
@end
@@ -119,7 +119,7 @@ + (NSDictionary *)generateServerValues:(id<FClock>)clock {
119
119
}
120
120
121
121
+ (id )resolveDeferredValue : (id )val
122
- withExisting : (id <JITExistingValue >)existing
122
+ withExisting : (id <ValueProvider >)existing
123
123
serverValues : (NSDictionary *)serverValues {
124
124
if (![val isKindOfClass: [NSDictionary class ]]) {
125
125
return val;
@@ -146,7 +146,7 @@ + (id)resolveScalarServerOp:(NSString *)op
146
146
}
147
147
148
148
+ (id )resolveComplexServerOp : (NSDictionary *)op
149
- withExisting : (id <JITExistingValue >)jitExisting
149
+ withExisting : (id <ValueProvider >)jitExisting
150
150
serverValues : (NSDictionary *)serverValues {
151
151
// Only increment is supported as of now
152
152
if (op[kIncrement ] == nil ) {
@@ -189,9 +189,9 @@ + (FCompoundWrite *)resolveDeferredValueCompoundWrite:(FCompoundWrite *)write
189
189
(NSDictionary *)serverValues {
190
190
__block FCompoundWrite *resolved = write;
191
191
[write enumerateWrites: ^(FPath *subPath, id <FNode> node, BOOL *stop) {
192
- id <JITExistingValue > existing = [[JITExistingValueSyncTree alloc ]
193
- initWithSyncTree: tree
194
- atPath: [path child: subPath]];
192
+ id <ValueProvider > existing =
193
+ [[DeferredValueProvider alloc ] initWithSyncTree: tree
194
+ atPath: [path child: subPath]];
195
195
id <FNode> resolvedNode =
196
196
[FServerValues resolveDeferredValueSnapshot: node
197
197
withJITExisting: existing
@@ -205,11 +205,11 @@ + (FCompoundWrite *)resolveDeferredValueCompoundWrite:(FCompoundWrite *)write
205
205
}
206
206
207
207
+ (id <FNode>)resolveDeferredValueSnapshot : (id <FNode>)node
208
- withSyncTree : (FSyncTree *)tree
208
+ withExisting : (FSyncTree *)tree
209
209
atPath : (FPath *)path
210
210
serverValues : (NSDictionary *)serverValues {
211
- id <JITExistingValue > jitExisting =
212
- [[JITExistingValueSyncTree alloc ] initWithSyncTree: tree atPath: path];
211
+ id <ValueProvider > jitExisting =
212
+ [[DeferredValueProvider alloc ] initWithSyncTree: tree atPath: path];
213
213
return [FServerValues resolveDeferredValueSnapshot: node
214
214
withJITExisting: jitExisting
215
215
serverValues: serverValues];
@@ -218,15 +218,15 @@ + (FCompoundWrite *)resolveDeferredValueCompoundWrite:(FCompoundWrite *)write
218
218
+ (id <FNode>)resolveDeferredValueSnapshot : (id <FNode>)node
219
219
withExisting : (id <FNode>)existing
220
220
serverValues : (NSDictionary *)serverValues {
221
- id <JITExistingValue > jitExisting =
222
- [[JITExistingValueSnapshot alloc ] initWithSnapshot: existing];
221
+ id <ValueProvider > jitExisting =
222
+ [[ExistingValueProvider alloc ] initWithSnapshot: existing];
223
223
return [FServerValues resolveDeferredValueSnapshot: node
224
224
withJITExisting: jitExisting
225
225
serverValues: serverValues];
226
226
}
227
227
228
228
+ (id <FNode>)resolveDeferredValueSnapshot : (id <FNode>)node
229
- withJITExisting : (id <JITExistingValue >)existing
229
+ withJITExisting : (id <ValueProvider >)existing
230
230
serverValues : (NSDictionary *)serverValues {
231
231
id priorityVal =
232
232
[FServerValues resolveDeferredValue: [[node getPriority ] val ]
0 commit comments