public static ISourceBlock <Either <TLeft, IList <TSuccess> > > BufferSafe <TLeft, TSuccess>(this ISourceBlock <Either <TLeft, TSuccess> > source, TimeSpan batchTimeout, int batchMaxSize) { var outputBlock = new BufferBlock <Either <TLeft, IList <TSuccess> > >(); source.AsObservable() .BufferSafe(batchTimeout, batchMaxSize) .Subscribe(outputBlock.AsObserver()); return(outputBlock); }
public static ISourceBlock <IList <T> > Buffer <T>(this ISourceBlock <T> source, TimeSpan batchTimeout, int batchMaxSize) { var outputBlock = new BufferBlock <IList <T> >(); source.AsObservable() .Buffer(batchTimeout, batchMaxSize) .Where(buffer => buffer.Count > 0) .Subscribe(outputBlock.AsObserver()); return(outputBlock); }
public static IDisposable LinkTo <TOutput, TState>( this ISourceBlock <TOutput> source, IAgent <TOutput, TState> agent) => source.AsObservable().Subscribe(agent.Post);
public static IEnumerable <T> ToEnumerable <T>(this ISourceBlock <T> source, CancellationToken cancelToken = default(CancellationToken)) { return(source.AsObservable().ToEnumerable()); }