Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: MergeManyChangeSets for Cache ChangeSets with List ChangeSets #790

Merged
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5cd0e5e
First drop of MergeManyChangeSets for List to Cache
dwcullop Dec 9, 2023
4663684
Fix test data
dwcullop Dec 9, 2023
b231a4d
Improved test
dwcullop Dec 9, 2023
1380fe3
Merge branch 'reactivemarbles:main' into feature/cache-list-mergemany…
dwcullop Dec 10, 2023
85bfd53
Unit Testing a thread issue
dwcullop Dec 11, 2023
65469a3
More progress on stress tests
dwcullop Dec 11, 2023
4383540
Merge branch 'feature/cache-list-mergemanychangesets' of https://gith…
dwcullop Dec 11, 2023
342a5b3
All Unit Tests Pass!
dwcullop Dec 13, 2023
deb843e
Stress Tester refactor
dwcullop Dec 13, 2023
6dc68cc
Finalization
dwcullop Dec 13, 2023
564c192
API Fixes
dwcullop Dec 13, 2023
980c116
Merge branch 'main' into feature/cache-list-mergemanychangesets
dwcullop Dec 13, 2023
940a533
Fixed Unit Tests
dwcullop Dec 14, 2023
17d8709
Merge branch 'feature/cache-list-mergemanychangesets' of https://gith…
dwcullop Dec 14, 2023
89c8244
Merge branch 'main' into feature/cache-list-mergemanychangesets
ChrisPulman Dec 14, 2023
4329f38
Fix Build, enable test
ChrisPulman Dec 14, 2023
610d39a
So close!
dwcullop Dec 14, 2023
10ab6f2
Merge branch 'feature/cache-list-mergemanychangesets' of https://gith…
dwcullop Dec 14, 2023
48327fc
Switch to bools
dwcullop Dec 14, 2023
ffd28cb
Code Cleanup
dwcullop Dec 15, 2023
89cecaf
Revert Change that may be the problem
dwcullop Dec 15, 2023
a475c48
Revert debugging helper
dwcullop Dec 15, 2023
99bed84
Update Stress Test
ChrisPulman Dec 15, 2023
315f013
Update List internal classes to be sealed
ChrisPulman Dec 15, 2023
c16c289
Enable other Skipped tests, no issues seem to be present
ChrisPulman Dec 15, 2023
b7b70d9
Convert to pure Observable no Sleep or Delay
ChrisPulman Dec 15, 2023
7606e1c
Improved Faker use of statics
dwcullop Dec 15, 2023
97acb8a
Simplify and add OnError notifications
ChrisPulman Dec 15, 2023
4fd1942
Revert "Update List internal classes to be sealed" because it has bee…
dwcullop Dec 16, 2023
7b495bf
Add sealed to a few classes
dwcullop Dec 16, 2023
c368e94
Merge branch 'main' into feature/cache-list-mergemanychangesets
ChrisPulman Dec 16, 2023
069b080
Finalize Test Code
dwcullop Dec 16, 2023
a50c022
Merge branch 'feature/cache-list-mergemanychangesets' of https://gith…
dwcullop Dec 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,14 @@ namespace DynamicData
public static System.IObservable<TDestination> MergeMany<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, TKey, System.IObservable<TDestination>> observableSelector)
where TObject : notnull
where TKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TKey : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, TKey, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TKey : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> MergeManyChangeSets<TObject, TKey, TDestination, TDestinationKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>>> observableSelector, System.Collections.Generic.IComparer<TDestination> comparer)
where TObject : notnull
where TKey : notnull
Expand Down Expand Up @@ -2128,7 +2136,7 @@ namespace DynamicData
where TKey : notnull { }
public static System.IObservable<TDestination> MergeMany<T, TDestination>(this System.IObservable<DynamicData.IChangeSet<T>> source, System.Func<T, System.IObservable<TDestination>> observableSelector)
where T : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector)
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> MergeManyChangeSets<TObject, TDestination, TDestinationKey>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>>> observableSelector, System.Collections.Generic.IComparer<TDestination> comparer)
Expand Down Expand Up @@ -2708,9 +2716,9 @@ namespace DynamicData.Tests
where TKey : notnull
{
public ChangeSetAggregator(System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source) { }
public bool Completed { get; }
public DynamicData.IObservableCache<TObject, TKey> Data { get; }
public System.Exception? Error { get; }
public bool IsCompleted { get; }
public System.Collections.Generic.IList<DynamicData.IChangeSet<TObject, TKey>> Messages { get; }
public DynamicData.Diagnostics.ChangeSummary Summary { get; }
public void Dispose() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,14 @@ namespace DynamicData
public static System.IObservable<TDestination> MergeMany<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, TKey, System.IObservable<TDestination>> observableSelector)
where TObject : notnull
where TKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TKey : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, TKey, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TKey : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> MergeManyChangeSets<TObject, TKey, TDestination, TDestinationKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>>> observableSelector, System.Collections.Generic.IComparer<TDestination> comparer)
where TObject : notnull
where TKey : notnull
Expand Down Expand Up @@ -2128,7 +2136,7 @@ namespace DynamicData
where TKey : notnull { }
public static System.IObservable<TDestination> MergeMany<T, TDestination>(this System.IObservable<DynamicData.IChangeSet<T>> source, System.Func<T, System.IObservable<TDestination>> observableSelector)
where T : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector)
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> MergeManyChangeSets<TObject, TDestination, TDestinationKey>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>>> observableSelector, System.Collections.Generic.IComparer<TDestination> comparer)
Expand Down Expand Up @@ -2708,9 +2716,9 @@ namespace DynamicData.Tests
where TKey : notnull
{
public ChangeSetAggregator(System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source) { }
public bool Completed { get; }
public DynamicData.IObservableCache<TObject, TKey> Data { get; }
public System.Exception? Error { get; }
public bool IsCompleted { get; }
public System.Collections.Generic.IList<DynamicData.IChangeSet<TObject, TKey>> Messages { get; }
public DynamicData.Diagnostics.ChangeSummary Summary { get; }
public void Dispose() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,14 @@ namespace DynamicData
public static System.IObservable<TDestination> MergeMany<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, TKey, System.IObservable<TDestination>> observableSelector)
where TObject : notnull
where TKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TKey : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TKey, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, TKey, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TKey : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> MergeManyChangeSets<TObject, TKey, TDestination, TDestinationKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>>> observableSelector, System.Collections.Generic.IComparer<TDestination> comparer)
where TObject : notnull
where TKey : notnull
Expand Down Expand Up @@ -2128,7 +2136,7 @@ namespace DynamicData
where TKey : notnull { }
public static System.IObservable<TDestination> MergeMany<T, TDestination>(this System.IObservable<DynamicData.IChangeSet<T>> source, System.Func<T, System.IObservable<TDestination>> observableSelector)
where T : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector)
public static System.IObservable<DynamicData.IChangeSet<TDestination>> MergeManyChangeSets<TObject, TDestination>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination>>> observableSelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null)
where TObject : notnull
where TDestination : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> MergeManyChangeSets<TObject, TDestination, TDestinationKey>(this System.IObservable<DynamicData.IChangeSet<TObject>> source, System.Func<TObject, System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>>> observableSelector, System.Collections.Generic.IComparer<TDestination> comparer)
Expand Down Expand Up @@ -2708,9 +2716,9 @@ namespace DynamicData.Tests
where TKey : notnull
{
public ChangeSetAggregator(System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source) { }
public bool Completed { get; }
public DynamicData.IObservableCache<TObject, TKey> Data { get; }
public System.Exception? Error { get; }
public bool IsCompleted { get; }
public System.Collections.Generic.IList<DynamicData.IChangeSet<TObject, TKey>> Messages { get; }
public DynamicData.Diagnostics.ChangeSummary Summary { get; }
public void Dispose() { }
Expand Down
8 changes: 4 additions & 4 deletions src/DynamicData.Tests/Cache/MergeChangeSetsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public void EveryItemVisibleWhenSequenceCompletes()
using var results = fixedMarketList.Select(m => m.LatestPrices).MergeChangeSets(completable: true).AsAggregator();

// then
results.Completed.Should().Be(true);
results.IsCompleted.Should().Be(true);
results.Data.Count.Should().Be(PricesPerMarket * MarketCount);
results.Summary.Overall.Adds.Should().Be(PricesPerMarket * MarketCount);
results.Summary.Overall.Removes.Should().Be(0);
Expand All @@ -727,7 +727,7 @@ public void MergedObservableCompletesWhenAllSourcesComplete(bool completeSources
using var results = fixedMarketList.Select(m => m.LatestPrices).MergeChangeSets(completable: true).AsAggregator();

// then
results.Completed.Should().Be(completeSources);
results.IsCompleted.Should().Be(completeSources);
}

[Theory]
Expand All @@ -744,7 +744,7 @@ public void MergedObservableRespectsCompletableFlag(bool completeSource, bool co
using var results = fixedMarketList.Select(m => m.LatestPrices).MergeChangeSets(completable: completeSource).AsAggregator();

// then
results.Completed.Should().Be(completeSource && completeChildren);
results.IsCompleted.Should().Be(completeSource && completeChildren);
}

[Fact]
Expand Down Expand Up @@ -846,7 +846,7 @@ public void ObservableObservableCompletesIfAndOnlyIfSourceAndAllChildrenComplete
using var results = observableObservable.MergeChangeSets().AsAggregator();

// then
results.Completed.Should().Be(completeSource && completeChildren);
results.IsCompleted.Should().Be(completeSource && completeChildren);
}

public void Dispose() => _marketList.ForEach(m => (m as IDisposable)?.Dispose());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace DynamicData.Tests.Cache;

public sealed class MergeManyCacheChangeSetsFixture : IDisposable
public sealed class MergeManyChangeSetsCacheFixture : IDisposable
{
#if DEBUG
const int MarketCount = 5;
Expand All @@ -37,7 +37,7 @@ public sealed class MergeManyCacheChangeSetsFixture : IDisposable

private readonly ChangeSetAggregator<IMarket, Guid> _marketCacheResults;

public MergeManyCacheChangeSetsFixture() => _marketCacheResults = _marketCache.Connect().AsAggregator();
public MergeManyChangeSetsCacheFixture() => _marketCacheResults = _marketCache.Connect().AsAggregator();

[Fact]
public void NullChecks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace DynamicData.Tests.Cache;

public sealed class MergeManyCacheChangeSetsSourceCompareFixture : IDisposable
public sealed class MergeManyChangeSetsCacheSourceCompareFixture : IDisposable
{
#if DEBUG
const int MarketCount = 5;
Expand All @@ -37,7 +37,7 @@ public sealed class MergeManyCacheChangeSetsSourceCompareFixture : IDisposable

private readonly ChangeSetAggregator<IMarket, Guid> _marketCacheResults;

public MergeManyCacheChangeSetsSourceCompareFixture() => _marketCacheResults = _marketCache.Connect().AsAggregator();
public MergeManyChangeSetsCacheSourceCompareFixture() => _marketCacheResults = _marketCache.Connect().AsAggregator();

[Fact]
public void NullChecks()
Expand Down
Loading