Skip to content

Commit 57a929f

Browse files
committed
fix/simplify: rebuild with cascade
1 parent ab0f09c commit 57a929f

14 files changed

+142
-218
lines changed

src/_common/Observables/IStreamHub.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public interface IStreamHub<in TIn, TOut>
9595
/// All periods (inclusive) after this DateTime will be removed.
9696
/// </param>
9797
/// <param name="notify">
98-
/// Send delete point to subscribers.
98+
/// Notify subscribers of the delete point.
9999
/// </param>
100100
void RemoveRange(DateTime fromTimestamp, bool notify);
101101

@@ -104,11 +104,11 @@ public interface IStreamHub<in TIn, TOut>
104104
/// </summary>
105105
/// <remarks>
106106
/// For observers, if your intention is to rebuild from a provider,
107-
/// use alternate <see cref="IStreamObserver{T}.Rebuild(int,int?)"/>.
107+
/// use alternate <see cref="IStreamObserver{T}.Rebuild(int)"/>.
108108
/// </remarks>
109109
/// <param name="fromIndex">From index, inclusive</param>
110110
/// <param name="notify">
111-
/// Send delete point to subscribers.
111+
/// Notify subscribers of the delete position.
112112
/// </param>
113113
void RemoveRange(int fromIndex, bool notify);
114114

src/_common/Observables/IStreamObserver.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ public interface IStreamObserver<in T>
3131
/// <param name="item">
3232
/// The current notification information.
3333
/// </param>
34-
/// <param name="indexHint">Provider index hint</param>
35-
void OnAdd(T item, int? indexHint);
34+
/// <param name="notify">
35+
/// Notify subsribers of the new item.
36+
/// </param>
37+
/// <param name="indexHint">
38+
/// Provider index hint, if known.
39+
/// </param>
40+
void OnAdd(T item, bool notify, int? indexHint);
3641

3742
/// <summary>
3843
/// Provides the observer with starting point in timeline
@@ -113,8 +118,5 @@ public interface IStreamObserver<in T>
113118
/// All periods (inclusive) after this index position
114119
/// will be removed and recalculated.
115120
/// </param>
116-
/// <param name="provIndex">
117-
/// Matching provider index, if known.
118-
/// </param>
119-
void Rebuild(int fromIndex, int? provIndex = null);
121+
void Rebuild(int fromIndex);
120122
}

src/_common/Observables/StreamHub.Observable.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void NotifyObserversOnAdd(TOut item, int? indexHint)
7575
// send to subscribers
7676
foreach (IStreamObserver<TOut> o in _observers.ToArray())
7777
{
78-
o.OnAdd(item, indexHint);
78+
o.OnAdd(item, notify: true, indexHint);
7979
}
8080
}
8181

src/_common/Observables/StreamHub.Observer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ public abstract partial class StreamHub<TIn, TOut> : IStreamObserver<TIn>
1212

1313
// observer methods
1414

15-
public virtual void OnAdd(TIn item, int? indexHint)
15+
public virtual void OnAdd(TIn item, bool notify, int? indexHint)
1616
{
1717
// pass-thru, usually
1818
(TOut result, int index) = ToIndicator(item, indexHint);
19-
AppendCache(result, index);
19+
AppendCache(result, notify);
2020
}
2121

2222
public void OnChange(DateTime fromTimestamp)

0 commit comments

Comments
 (0)