Skip to content

Commit 74f9210

Browse files
committed
Rename types to match JS sdk
1 parent 8e3f827 commit 74f9210

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

Firebase/Database/Core/FRepo.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ - (void)restoreWrites {
248248
withCallback:callback];
249249
id<FNode> resolved =
250250
[FServerValues resolveDeferredValueSnapshot:write.overwrite
251-
withSyncTree:self.serverSyncTree
251+
withExisting:self.serverSyncTree
252252
atPath:write.path
253253
serverValues:serverValues];
254254
[self.serverSyncTree applyUserOverwriteAtPath:write.path

Firebase/Database/Core/FServerValues.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
serverValues:
3232
(NSDictionary *)serverValues;
3333
+ (id<FNode>)resolveDeferredValueSnapshot:(id<FNode>)node
34-
withSyncTree:(id<FNode>)existing
34+
withExisting:(id<FNode>)existing
3535
atPath:(FPath *)path
3636
serverValues:(NSDictionary *)serverValues;
3737
+ (id<FNode>)resolveDeferredValueSnapshot:(id<FNode>)node

Firebase/Database/Core/FServerValues.m

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,37 +44,37 @@ BOOL canBeRepresentedAsLong(NSNumber *num) {
4444
// hit, we wrap around existing data of either snapshot or CompoundWrite
4545
// (allowing us to share code) and read from the CompoundWrite only when/where
4646
// 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;
4949
- (id<FNode>)value;
5050
@end
5151

52-
@interface JITExistingValueSyncTree : NSObject <JITExistingValue>
52+
@interface DeferredValueProvider : NSObject <ValueProvider>
5353
- (instancetype)initWithSyncTree:(FSyncTree *)tree atPath:(FPath *)path;
54-
- (id<JITExistingValue>)getChild:(NSString *)pathSegment;
54+
- (id<ValueProvider>)getChild:(NSString *)pathSegment;
5555
- (id<FNode>)value;
5656
@property FPath *path;
5757
@property FSyncTree *tree;
5858
@end
5959

60-
@interface JITExistingValueSnapshot : NSObject <JITExistingValue>
60+
@interface ExistingValueProvider : NSObject <ValueProvider>
6161
- (instancetype)initWithSnapshot:(id<FNode>)snapshot;
62-
- (id<JITExistingValue>)getChild:(NSString *)pathSegment;
62+
- (id<ValueProvider>)getChild:(NSString *)pathSegment;
6363
- (id<FNode>)value;
6464
@property id<FNode> snapshot;
6565
@end
6666

67-
@implementation JITExistingValueSyncTree
67+
@implementation DeferredValueProvider
6868
- (instancetype)initWithSyncTree:(FSyncTree *)tree atPath:(FPath *)path {
6969
self.tree = tree;
7070
self.path = path;
7171
return self;
7272
}
7373

74-
- (id<JITExistingValue>)getChild:(NSString *)pathSegment {
74+
- (id<ValueProvider>)getChild:(NSString *)pathSegment {
7575
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];
7878
}
7979

8080
- (id<FNode>)value {
@@ -83,14 +83,14 @@ - (instancetype)initWithSyncTree:(FSyncTree *)tree atPath:(FPath *)path {
8383
}
8484
@end
8585

86-
@implementation JITExistingValueSnapshot
86+
@implementation ExistingValueProvider
8787
- (instancetype)initWithSnapshot:(id<FNode>)snapshot {
8888
self.snapshot = snapshot;
8989
return self;
9090
}
9191

92-
- (id<JITExistingValue>)getChild:(NSString *)pathSegment {
93-
return [[JITExistingValueSnapshot alloc]
92+
- (id<ValueProvider>)getChild:(NSString *)pathSegment {
93+
return [[ExistingValueProvider alloc]
9494
initWithSnapshot:[self.snapshot getImmediateChild:pathSegment]];
9595
}
9696

@@ -103,10 +103,10 @@ @interface FServerValues ()
103103
+ (id)resolveScalarServerOp:(NSString *)op
104104
withServerValues:(NSDictionary *)serverValues;
105105
+ (id)resolveComplexServerOp:(NSDictionary *)op
106-
withExisting:(id<JITExistingValue>)existing
106+
withExisting:(id<ValueProvider>)existing
107107
serverValues:(NSDictionary *)serverValues;
108108
+ (id<FNode>)resolveDeferredValueSnapshot:(id<FNode>)node
109-
withJITExisting:(id<JITExistingValue>)existing
109+
withJITExisting:(id<ValueProvider>)existing
110110
serverValues:(NSDictionary *)serverValues;
111111

112112
@end
@@ -119,7 +119,7 @@ + (NSDictionary *)generateServerValues:(id<FClock>)clock {
119119
}
120120

121121
+ (id)resolveDeferredValue:(id)val
122-
withExisting:(id<JITExistingValue>)existing
122+
withExisting:(id<ValueProvider>)existing
123123
serverValues:(NSDictionary *)serverValues {
124124
if (![val isKindOfClass:[NSDictionary class]]) {
125125
return val;
@@ -146,7 +146,7 @@ + (id)resolveScalarServerOp:(NSString *)op
146146
}
147147

148148
+ (id)resolveComplexServerOp:(NSDictionary *)op
149-
withExisting:(id<JITExistingValue>)jitExisting
149+
withExisting:(id<ValueProvider>)jitExisting
150150
serverValues:(NSDictionary *)serverValues {
151151
// Only increment is supported as of now
152152
if (op[kIncrement] == nil) {
@@ -189,9 +189,9 @@ + (FCompoundWrite *)resolveDeferredValueCompoundWrite:(FCompoundWrite *)write
189189
(NSDictionary *)serverValues {
190190
__block FCompoundWrite *resolved = write;
191191
[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]];
195195
id<FNode> resolvedNode =
196196
[FServerValues resolveDeferredValueSnapshot:node
197197
withJITExisting:existing
@@ -205,11 +205,11 @@ + (FCompoundWrite *)resolveDeferredValueCompoundWrite:(FCompoundWrite *)write
205205
}
206206

207207
+ (id<FNode>)resolveDeferredValueSnapshot:(id<FNode>)node
208-
withSyncTree:(FSyncTree *)tree
208+
withExisting:(FSyncTree *)tree
209209
atPath:(FPath *)path
210210
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];
213213
return [FServerValues resolveDeferredValueSnapshot:node
214214
withJITExisting:jitExisting
215215
serverValues:serverValues];
@@ -218,15 +218,15 @@ + (FCompoundWrite *)resolveDeferredValueCompoundWrite:(FCompoundWrite *)write
218218
+ (id<FNode>)resolveDeferredValueSnapshot:(id<FNode>)node
219219
withExisting:(id<FNode>)existing
220220
serverValues:(NSDictionary *)serverValues {
221-
id<JITExistingValue> jitExisting =
222-
[[JITExistingValueSnapshot alloc] initWithSnapshot:existing];
221+
id<ValueProvider> jitExisting =
222+
[[ExistingValueProvider alloc] initWithSnapshot:existing];
223223
return [FServerValues resolveDeferredValueSnapshot:node
224224
withJITExisting:jitExisting
225225
serverValues:serverValues];
226226
}
227227

228228
+ (id<FNode>)resolveDeferredValueSnapshot:(id<FNode>)node
229-
withJITExisting:(id<JITExistingValue>)existing
229+
withJITExisting:(id<ValueProvider>)existing
230230
serverValues:(NSDictionary *)serverValues {
231231
id priorityVal =
232232
[FServerValues resolveDeferredValue:[[node getPriority] val]

Firebase/Database/Core/FSyncTree.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ - (NSArray *)ackUserWriteWithWriteId:(NSInteger)writeId
234234
if ([write isOverwrite]) {
235235
id<FNode> resolvedNode =
236236
[FServerValues resolveDeferredValueSnapshot:write.overwrite
237-
withSyncTree:self
237+
withExisting:self
238238
atPath:write.path
239239
serverValues:serverValues];
240240
[self.persistenceManager applyUserWrite:resolvedNode

0 commit comments

Comments
 (0)