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

Oryx v3 #66

Merged
merged 16 commits into from Feb 24, 2021
Merged

Oryx v3 #66

merged 16 commits into from Feb 24, 2021

Conversation

dbrattli
Copy link
Collaborator

@dbrattli dbrattli commented Feb 21, 2021

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).

@codecov
Copy link

codecov bot commented Feb 22, 2021

Codecov Report

Merging #66 (17a7fe0) into master (eaef012) will increase coverage by 0.10%.
The diff coverage is 78.15%.

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   80.03%   80.14%   +0.10%     
==========================================
  Files          10        9       -1     
  Lines         501      700     +199     
  Branches       24       13      -11     
==========================================
+ Hits          401      561     +160     
- Misses         91      133      +42     
+ Partials        9        6       -3     
Impacted Files Coverage Δ
src/Chunk.fs 100.00% <ø> (ø)
src/Logging.fs 72.52% <71.95%> (+2.88%) ⬆️
src/Handler.fs 72.81% <72.50%> (+1.92%) ⬆️
src/Context.fs 82.05% <80.00%> (+0.87%) ⬆️
src/Builder.fs 94.28% <93.33%> (-1.37%) ⬇️
src/Fetch.fs 96.34% <98.24%> (+10.62%) ⬆️
src/Error.fs 100.00% <100.00%> (ø)

@dbrattli dbrattli changed the title [WIP] Oryx v3 Oryx v3 Feb 22, 2021
@dbrattli dbrattli marked this pull request as ready for review February 22, 2021 19:45
@dbrattli dbrattli requested a review from a team February 22, 2021 19:46
@dbrattli dbrattli merged commit 2e2a279 into master Feb 24, 2021
@dbrattli dbrattli deleted the feature/oryx-v3 branch February 24, 2021 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants