All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.stratalab.node.services.RegtestRpcFs2Grpc.scala Maven / Gradle / Ivy

The newest version!
package xyz.stratalab.node.services

import _root_.cats.syntax.all._

trait RegtestRpcFs2Grpc[F[_], A] {
  def makeBlocks(request: xyz.stratalab.node.services.MakeBlocksReq, ctx: A): F[xyz.stratalab.node.services.MakeBlocksRes]
}

object RegtestRpcFs2Grpc extends _root_.fs2.grpc.GeneratedCompanion[RegtestRpcFs2Grpc] {
  
  def mkClient[F[_]: _root_.cats.effect.Async, A](dispatcher: _root_.cats.effect.std.Dispatcher[F], channel: _root_.io.grpc.Channel, mkMetadata: A => F[_root_.io.grpc.Metadata], clientOptions: _root_.fs2.grpc.client.ClientOptions): RegtestRpcFs2Grpc[F, A] = new RegtestRpcFs2Grpc[F, A] {
    def makeBlocks(request: xyz.stratalab.node.services.MakeBlocksReq, ctx: A): F[xyz.stratalab.node.services.MakeBlocksRes] = {
      mkMetadata(ctx).flatMap { m =>
        _root_.fs2.grpc.client.Fs2ClientCall[F](channel, xyz.stratalab.node.services.RegtestRpcGrpc.METHOD_MAKE_BLOCKS, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(request, m))
      }
    }
  }
  
  protected def serviceBinding[F[_]: _root_.cats.effect.Async, A](dispatcher: _root_.cats.effect.std.Dispatcher[F], serviceImpl: RegtestRpcFs2Grpc[F, A], mkCtx: _root_.io.grpc.Metadata => F[A], serverOptions: _root_.fs2.grpc.server.ServerOptions): _root_.io.grpc.ServerServiceDefinition = {
    _root_.io.grpc.ServerServiceDefinition
      .builder(xyz.stratalab.node.services.RegtestRpcGrpc.SERVICE)
      .addMethod(xyz.stratalab.node.services.RegtestRpcGrpc.METHOD_MAKE_BLOCKS, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCall[xyz.stratalab.node.services.MakeBlocksReq, xyz.stratalab.node.services.MakeBlocksRes]((r, m) => mkCtx(m).flatMap(serviceImpl.makeBlocks(r, _))))
      .build()
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy