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

Added ZIO based server for netty #2574

Closed
wants to merge 6 commits into from

Conversation

Pask423
Copy link
Contributor

@Pask423 Pask423 commented Nov 17, 2022

No description provided.

build.sbt Outdated
.settings(
name := "tapir-netty-server-zio",
libraryDependencies ++= Seq(
"io.netty" % "netty-all" % "4.1.82.Final",
Copy link
Member

Choose a reason for hiding this comment

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

let's extract netty's version to a constant in the build so that it's not repeated

build.sbt Outdated
"dev.zio" %% "zio-interop-cats" % Versions.zioInteropCats,
) ++ loggerDependencies,
// needed because of https://github.com/coursier/coursier/issues/2016
useCoursier := false
Copy link
Member

Choose a reason for hiding this comment

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

maybe some common netty-settings to avoid duplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that not much things can be move to common as most setting is different between backends

Copy link
Member

Choose a reason for hiding this comment

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

even if it's 2 settings let's factor them out so that we don't repeat the comments etc.

case class NettyZioServer[R, SA <: SocketAddress](routes: Vector[Route[RIO[R, *]]], options: NettyZioServerOptions[R, SA])(implicit
runtime: Runtime[R]
) {
def addEndpoint(se: ServerEndpoint[Any, RIO[R, *]]): NettyZioServer[R, SA] = addEndpoints(List(se))
Copy link
Member

Choose a reason for hiding this comment

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

I think here we should use ZServerEndpoint from sttp.tapir.ztapir

import sttp.tapir.server.netty.internal.FutureUtil
import zio.{RIO, ZIO}

object ZioUtil {
Copy link
Member

Choose a reason for hiding this comment

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

this can be private?

Copy link
Member

Choose a reason for hiding this comment

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

and this function is available from the parent project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure which one ? FutureUtil is public

Copy link
Member

Choose a reason for hiding this comment

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

Ah it's a conversion to RIO, ok. Does it need to be public? It looks like an impl detail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already moved to private in zio

@adamw
Copy link
Member

adamw commented Nov 17, 2022

Looks good - docs are missing :)

@Pask423
Copy link
Contributor Author

Pask423 commented Nov 18, 2022

Seventh task in #499

@adamw
Copy link
Member

adamw commented Nov 18, 2022

You'll also probably need to implement this: #2579 in the ZIO variant (RunAsync)

@Pask423
Copy link
Contributor Author

Pask423 commented Nov 30, 2022

closes in favor of #2602

@Pask423 Pask423 closed this Nov 30, 2022
@mergify mergify bot deleted the feature/netty-zio branch November 30, 2022 11:50
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.

2 participants