Skip to content

Commit 1b1cf36

Browse files
Merge pull request #66 from ParsePlatform/richardross.mutablecontainers.kill
Remove mutable containers functionality.
2 parents e3a1864 + ea6f6c0 commit 1b1cf36

File tree

8 files changed

+2
-113
lines changed

8 files changed

+2
-113
lines changed

Parse/Internal/ParseJSONCacheItem.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

Parse/Parse.Android.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
<Compile Include="Internal\ParseDeleteOperation.cs" />
110110
<Compile Include="Internal\ParseFieldOperations.cs" />
111111
<Compile Include="Internal\ParseIncrementOperation.cs" />
112-
<Compile Include="Internal\ParseJSONCacheItem.cs" />
113112
<Compile Include="Internal\ParseRelationOperation.cs" />
114113
<Compile Include="Internal\ParseRemoveOperation.cs" />
115114
<Compile Include="Internal\ParseSetOperation.cs" />

Parse/Parse.Unity.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
<Compile Include="Internal\ParseEncoder.cs" />
9999
<Compile Include="Internal\ParseFieldOperations.cs" />
100100
<Compile Include="Internal\ParseIncrementOperation.cs" />
101-
<Compile Include="Internal\ParseJSONCacheItem.cs" />
102101
<Compile Include="Internal\ParseObjectCoder.cs" />
103102
<Compile Include="Internal\ParseRelationOperation.cs" />
104103
<Compile Include="Internal\ParseRemoveOperation.cs" />

Parse/Parse.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
<Compile Include="ParseFieldNameAttribute.cs" />
9292
<Compile Include="Internal\ParseFieldOperations.cs" />
9393
<Compile Include="Internal\ParseIncrementOperation.cs" />
94-
<Compile Include="Internal\ParseJSONCacheItem.cs" />
9594
<Compile Include="Internal\ParseRelationOperation.cs" />
9695
<Compile Include="Internal\ParseRemoveOperation.cs" />
9796
<Compile Include="Internal\ParseSetOperation.cs" />
@@ -142,9 +141,4 @@
142141
<Target Name="AfterBuild">
143142
</Target>
144143
-->
145-
<ItemGroup>
146-
<Folder Include="Internal\Config\" />
147-
<Folder Include="Internal\Push\State\" />
148-
<Folder Include="Internal\Push\Coder\" />
149-
</ItemGroup>
150144
</Project>

Parse/Parse.iOS.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
<Compile Include="Internal\ParseEncoder.cs" />
145145
<Compile Include="Internal\ParseFieldOperations.cs" />
146146
<Compile Include="Internal\ParseIncrementOperation.cs" />
147-
<Compile Include="Internal\ParseJSONCacheItem.cs" />
148147
<Compile Include="Internal\ParseObjectCoder.cs" />
149148
<Compile Include="Internal\ParseRelationOperation.cs" />
150149
<Compile Include="Internal\ParseRemoveOperation.cs" />

Parse/ParseClient.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ internal static Guid? InstallationId {
105105
}
106106
}
107107

108-
internal static bool IsContainerObject(object value) {
109-
return value is ParseACL ||
110-
value is ParseGeoPoint ||
111-
ConvertTo<IDictionary<string, object>>(value) is IDictionary<string, object> ||
112-
ConvertTo<IList<object>>(value) is IList<object>;
113-
}
114-
115108
/// <summary>
116109
/// Performs a ConvertTo, but returns null if the object can't be
117110
/// converted to that type.

Parse/ParseObject.cs

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ private static readonly IDictionary<Type, IDictionary<string, string>>
4141
private readonly LinkedList<IDictionary<string, IParseFieldOperation>> operationSetQueue =
4242
new LinkedList<IDictionary<string, IParseFieldOperation>>();
4343
private readonly IDictionary<string, object> estimatedData = new Dictionary<string, object>();
44-
private readonly IDictionary<object, ParseJSONCacheItem> hashedObjects =
45-
new Dictionary<object, ParseJSONCacheItem>();
4644

4745
private static readonly ThreadLocal<bool> isCreatingPointer = new ThreadLocal<bool>(() => false);
4846

@@ -430,10 +428,7 @@ internal virtual void MergeFromServer(IObjectState serverState) {
430428

431429
foreach (var pair in serverState) {
432430
var value = pair.Value;
433-
if (ParseClient.IsContainerObject(value)) {
434-
// Fill in the cache.
435-
AddToHashedObjects(value);
436-
} else if (value is ParseObject) {
431+
if (value is ParseObject) {
437432
// Resolve fetched object.
438433
var parseObject = value as ParseObject;
439434
if (fetchedObject.ContainsKey(parseObject.ObjectId)) {
@@ -485,58 +480,6 @@ private bool HasDirtyChildren {
485480
}
486481
}
487482

488-
/// <summary>
489-
/// Updates the JSON cache value for the given object.
490-
/// </summary>
491-
private void CheckpointMutableContainer(object obj) {
492-
lock (mutex) {
493-
if (ParseClient.IsContainerObject(obj)) {
494-
hashedObjects[obj] = new ParseJSONCacheItem(obj);
495-
}
496-
}
497-
}
498-
499-
/// <summary>
500-
/// Inspects to see if a given mutable container owned by this object has
501-
/// been mutated, and treats any mutation as a new "set" operation.
502-
/// </summary>
503-
private void CheckForChangesToMutableContainer(string key, object obj) {
504-
lock (mutex) {
505-
if (ParseClient.IsContainerObject(obj)) {
506-
ParseJSONCacheItem oldCacheItem;
507-
hashedObjects.TryGetValue(obj, out oldCacheItem);
508-
if (oldCacheItem == null) {
509-
throw new ArgumentException("ParseObjects contains container item that isn't cached.");
510-
}
511-
var newCacheItem = new ParseJSONCacheItem(obj);
512-
if (!oldCacheItem.Equals(newCacheItem)) {
513-
// A mutable container changed out from under us. Treat it as a set operation.
514-
PerformOperation(key, new ParseSetOperation(obj));
515-
}
516-
} else {
517-
if (obj != null) {
518-
hashedObjects.Remove(obj);
519-
}
520-
}
521-
}
522-
}
523-
524-
/// <summary>
525-
/// Inspects to see if any mutable container owned by this object has been mutated, and
526-
/// treats any mutation as a new 'Set' operation.
527-
/// </summary>
528-
internal void CheckForChangesToMutableContainers() {
529-
lock (mutex) {
530-
foreach (var pair in new Dictionary<string, object>(estimatedData)) {
531-
CheckForChangesToMutableContainer(pair.Key, pair.Value);
532-
}
533-
var toRemove = hashedObjects.Keys.Except(estimatedData.Values).ToArray();
534-
foreach (var key in toRemove) {
535-
hashedObjects.Remove(key);
536-
}
537-
}
538-
}
539-
540483
/// <summary>
541484
/// Flattens dictionaries and lists into a single enumerable of all contained objects
542485
/// that can then be queried over.
@@ -1149,10 +1092,6 @@ internal void RebuildEstimatedData() {
11491092
foreach (var operations in operationSetQueue) {
11501093
ApplyOperations(operations, estimatedData);
11511094
}
1152-
hashedObjects.Clear();
1153-
foreach (var pair in estimatedData) {
1154-
CheckpointMutableContainer(pair.Value);
1155-
}
11561095
// We've just applied a bunch of operations to estimatedData which
11571096
// may have changed all of its keys. Notify of all keys and properties
11581097
// mapped to keys being changed.
@@ -1184,7 +1123,6 @@ internal void PerformOperation(string key, IParseFieldOperation operation) {
11841123
OnPropertyChanged("IsDirty");
11851124
}
11861125

1187-
CheckpointMutableContainer(newValue);
11881126
OnFieldsChanged(new[] { key });
11891127
}
11901128
}
@@ -1493,12 +1431,6 @@ public ICollection<string> Keys {
14931431
}
14941432
}
14951433

1496-
internal void AddToHashedObjects(object obj) {
1497-
lock (mutex) {
1498-
hashedObjects[obj] = new ParseJSONCacheItem(obj);
1499-
}
1500-
}
1501-
15021434
/// <summary>
15031435
/// Gets or sets the ParseACL governing this object.
15041436
/// </summary>
@@ -1588,7 +1520,6 @@ public bool IsKeyDirty(string key) {
15881520

15891521
private bool CheckIsDirty(bool considerChildren) {
15901522
lock (mutex) {
1591-
CheckForChangesToMutableContainers();
15921523
return (dirty || CurrentOperations.Count > 0 || (considerChildren && HasDirtyChildren));
15931524
}
15941525
}

Parse/ParseUser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ internal Task LinkWithAsync(string authType, IDictionary<string, object> data, C
558558
authData = AuthData = new Dictionary<string, IDictionary<string, object>>();
559559
}
560560
authData[authType] = data;
561+
AuthData = authData;
561562
return SaveAsync(cancellationToken);
562563
}, cancellationToken);
563564
}

0 commit comments

Comments
 (0)