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

fs2 support #1042

Merged
merged 21 commits into from Jan 8, 2019
Merged

fs2 support #1042

merged 21 commits into from Jan 8, 2019

Conversation

sergeykolbasov
Copy link
Collaborator

@sergeykolbasov sergeykolbasov commented Nov 18, 2018

Related to #1001

Idea is to have streamBody and jsonStreamBody endpoints in core, along with StreamingLaws, so modules like iteratee and fs2 could implement only neccessary type classes and couple of specs while the rest of machinery is done inside of the core.

  • Refactoring
  • fs2 module + circe instances for it

@sergeykolbasov sergeykolbasov force-pushed the fs2-support branch 3 times, most recently from b6fc90c to 5869a46 Compare November 18, 2018 17:13
@codecov-io
Copy link

codecov-io commented Nov 18, 2018

Codecov Report

Merging #1042 into master will increase coverage by 0.15%.
The diff coverage is 80.7%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1042      +/-   ##
=========================================
+ Coverage   83.95%   84.1%   +0.15%     
=========================================
  Files          50      53       +3     
  Lines         941     969      +28     
  Branches       56      57       +1     
=========================================
+ Hits          790     815      +25     
- Misses        151     154       +3
Impacted Files Coverage Δ
...re/src/main/scala/io/finch/internal/ToEffect.scala 88.88% <ø> (ø) ⬆️
...src/main/scala/io/finch/EndpointStreamModule.scala 0% <0%> (ø)
...amples/src/main/scala/io/finch/iteratee/Main.scala 0% <0%> (ø) ⬆️
circe/src/main/scala/io/finch/circe/Decoders.scala 100% <100%> (ø) ⬆️
...in/scala/io/finch/circe/AccumulatingDecoders.scala 100% <100%> (ø) ⬆️
...c/main/scala/io/finch/streaming/DecodeStream.scala 100% <100%> (ø)
...ore/src/main/scala/io/finch/internal/package.scala 97.5% <100%> (+0.06%) ⬆️
...in/scala/io/finch/streaming/StreamFromReader.scala 100% <100%> (ø)
core/src/main/scala/io/finch/Endpoint.scala 71.59% <70%> (-1.31%) ⬇️
...tee/src/main/scala/io/finch/iteratee/package.scala 92.3% <85.71%> (+0.64%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49ec71b...2cceff1. Read the comment docs.

@vkostyukov
Copy link
Collaborator

Hey @sergeykolbasov! I see this is WIP - let me know whey you think this is ready for review.

@sergeykolbasov sergeykolbasov changed the title [WIP] fs2 support fs2 support Nov 19, 2018
@sergeykolbasov
Copy link
Collaborator Author

@vkostyukov It's good to go

Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only looked at the big picture. As usual, this is an amazing work @sergeykolbasov!

My big questions are:

  • Can we get rid of StreamFromReader
  • Can we provide missing instances to make streamBody[Reader, ???, Buf] work (would really like that; in future this could be available via an alias streamBodyReader[???, Buf]).
  • Can we provide missing instances to make streamBody[AsyncStream, ???, Buf] work (less concerned about that - want to rip off any AsyncStream bits from Finch in the long run, Reader is fine though).

build.sbt Show resolved Hide resolved
core/src/main/scala/io/finch/internal/package.scala Outdated Show resolved Hide resolved
core/src/main/scala/io/finch/streaming/StreamDecode.scala Outdated Show resolved Hide resolved
core/src/main/scala/io/finch/streaming/StreamDecode.scala Outdated Show resolved Hide resolved
core/src/main/scala/io/finch/EndpointModule.scala Outdated Show resolved Hide resolved
Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More comments from my side. I still need to think about wether we need to merge those type-classes together.

@vkostyukov
Copy link
Collaborator

Hey @sergeykolbasov! I was thinking we could ship this in 0.27, before the NY. What's your plan with this?

@sergeykolbasov sergeykolbasov force-pushed the fs2-support branch 3 times, most recently from 485777c to 39bf504 Compare December 15, 2018 10:20
@sergeykolbasov
Copy link
Collaborator Author

I'm in the process of polishing things

@sergeykolbasov
Copy link
Collaborator Author

sergeykolbasov commented Dec 16, 2018

@vkostyukov it should be fine by now
Also, I'll be out for the upcoming week.

Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks just great @sergeykolbasov! Just some nits from me. I feel it's pretty much ready to. The biggest concern I have is about backwards compatibility.

@@ -45,6 +45,11 @@ sealed abstract class EndpointResult[F[_], +A] {
case _ => None
}

final def map[B](fn: A => B)(implicit F: Effect[F]): EndpointResult[F, B] = this match {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to make streamJsonBody simpler. We still need the access to Input.request.charsetOrUtf8 to run the decoder, so it's impossible to just use streamBody.map(a => b).
Check implementation of this endpoint.

core/src/main/scala/io/finch/EndpointStreamModule.scala Outdated Show resolved Hide resolved
core/src/main/scala/io/finch/internal/package.scala Outdated Show resolved Hide resolved
Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did one more run which raised more questions - nothing major but we should try to address them.

circe/src/main/scala/io/finch/circe/Decoders.scala Outdated Show resolved Hide resolved
fs2/src/main/scala/io/finch/fs2/package.scala Outdated Show resolved Hide resolved
fs2/src/main/scala/io/finch/fs2/package.scala Outdated Show resolved Hide resolved
fs2/src/main/scala/io/finch/fs2/package.scala Outdated Show resolved Hide resolved
fs2/src/main/scala/io/finch/fs2/package.scala Show resolved Hide resolved
@sergeykolbasov
Copy link
Collaborator Author

@vkostyukov mind to give it another look?

Let's make this PR a New Year resolution 😄

@vkostyukov
Copy link
Collaborator

Going to look tonight @sergeykolbasov!

What's your opinion on this vs #1056. Which one should go first?

Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like all of this! Just couple of nits and this is ready to go!

core/src/main/scala/io/finch/streaming/DecodeStream.scala Outdated Show resolved Hide resolved
core/src/main/scala/io/finch/internal/ToEffect.scala Outdated Show resolved Hide resolved
@sergeykolbasov
Copy link
Collaborator Author

That's creepy. I can't reproduce the build error on my machine. Assume, there is a conflict in circe-jawn between 0.11.0 and 0.10.0 as circe-fs2 still depends on the old one.

@travisbrown
Copy link
Collaborator

travisbrown commented Jan 4, 2019

@sergeykolbasov Hoping to have circe-fs2 published soon—its tests turned up a bug in Jawn 0.14.0 that I thought we could merged pretty quickly: typelevel/jawn#144

@sergeykolbasov
Copy link
Collaborator Author

Thanks for the info, Travis!

Waiting for the resolution then

Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@travisbrown Thanks for the details!

@sergeykolbasov I'm happy when CI is happy! Appreciate your hard work on this. When it's merged, I can rebase #1056 so we can take another look at it.

@sergeykolbasov sergeykolbasov merged commit 66f15e2 into finagle:master Jan 8, 2019
@vkostyukov vkostyukov mentioned this pull request Jan 9, 2019
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

5 participants