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

org.plasmalabs.node.services.RegtestRpcFs2Grpc.scala Maven / Gradle / Ivy

The newest version!
package org.plasmalabs.node.services

import _root_.cats.syntax.all._

trait RegtestRpcFs2Grpc[F[_], A] {
  def makeBlocks(request: org.plasmalabs.node.services.MakeBlocksReq, ctx: A): F[org.plasmalabs.node.services.MakeBlocksRes]
  def setVoting(request: org.plasmalabs.node.services.SetVotingReq, ctx: A): F[org.plasmalabs.node.services.SetVotingRes]
}

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: org.plasmalabs.node.services.MakeBlocksReq, ctx: A): F[org.plasmalabs.node.services.MakeBlocksRes] = {
      mkMetadata(ctx).flatMap { m =>
        _root_.fs2.grpc.client.Fs2ClientCall[F](channel, org.plasmalabs.node.services.RegtestRpcGrpc.METHOD_MAKE_BLOCKS, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(request, m))
      }
    }
    def setVoting(request: org.plasmalabs.node.services.SetVotingReq, ctx: A): F[org.plasmalabs.node.services.SetVotingRes] = {
      mkMetadata(ctx).flatMap { m =>
        _root_.fs2.grpc.client.Fs2ClientCall[F](channel, org.plasmalabs.node.services.RegtestRpcGrpc.METHOD_SET_VOTING, 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(org.plasmalabs.node.services.RegtestRpcGrpc.SERVICE)
      .addMethod(org.plasmalabs.node.services.RegtestRpcGrpc.METHOD_MAKE_BLOCKS, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCall[org.plasmalabs.node.services.MakeBlocksReq, org.plasmalabs.node.services.MakeBlocksRes]((r, m) => mkCtx(m).flatMap(serviceImpl.makeBlocks(r, _))))
      .addMethod(org.plasmalabs.node.services.RegtestRpcGrpc.METHOD_SET_VOTING, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCall[org.plasmalabs.node.services.SetVotingReq, org.plasmalabs.node.services.SetVotingRes]((r, m) => mkCtx(m).flatMap(serviceImpl.setVoting(r, _))))
      .build()
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy