9

Github Oryx v3 by dbrattli · Pull Request #66 · cognitedata/oryx · GitHub

 3 years ago
source link: https://github.com/cognitedata/oryx/pull/66
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Collaborator

dbrattli commented on Feb 21

edited

Oryx v3 will be based on async observable instead of result returning continuations. The "result returning continuations" was problematic in the sense that they both push values down the chain in addition to returning (pulling) async values back up again. Thus each HTTP handler needed to care about the final result type of the total pipeline of handlers ('TResult). By never returning anything (Task<unit>) we get rid of this annoying return type.

... this change effectively makes Oryx an Async Observable:

type IHttpObserver<'TSource> =
    abstract member NextAsync: context: Context * ?content: 'TSource -> Task<unit>
    abstract member ErrorAsync: context: Context * error: exn -> Task<unit>

type HttpHandler<'TSource, 'TResult> = IHttpObserver<'TResult> -> IHttpObserver<'TSource>
type HttpHandler<'TSource> = IHttpObserver<'TSource> -> IHttpObserver<'TSource>

The difference from observables is that the "subscribe" function (HttpHandler) returns another Observer (IHttpFunc) instead of a Disposable and this observable is the side-effect that injects values into the pipeline (aka Rx Subject).


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK