Feature: EditDiff extension method for IObservable<IEnumerable<T>> #738
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When #736 completes, it will be handy to have more ways to create child changesets that can be merged together and treated as a single stream of changes.
To that end, the PR adds an
EditDiff
extension method toIObservable<IEnumerable<T>>
to create a changeset from a collection that changes over time. It is similar to (and internally leverages) theEditDiff
extension method forISourceCache
that updates the contents of a cache to match a given collection by only applying the changes. However, it operates on Observable collections and updates a dedicated cache each time a new collection is observed. It is the counterpart toToCollection
.This method is distinct from
ToObservableChangeSet
that only adds/updates each item in each observed collection (with an option to expire).EditDiff
will remove values if they're NOT observed in subsequent versions of the collection.Example
Performance
I've included a Perf test in the unit tests. The performance is reasonable, but scales with the size of the collections, and I am open to any ideas around improving performance. However, since it leverages the single collection version of
EditDiff
, it would be more appropriate to put any optimizations in there (but it seems fairly optimized already).