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

fs2-grpc.com.eventstore.dbclient.proto.gossip.GossipFs2GrpcTrailers.scala Maven / Gradle / Ivy

The newest version!
package com.eventstore.dbclient.proto.gossip

import _root_.cats.syntax.all.*

trait GossipFs2GrpcTrailers[F[_], A] {
  def read(request: com.eventstore.dbclient.proto.shared.Empty, ctx: A): F[(com.eventstore.dbclient.proto.gossip.ClusterInfo, _root_.io.grpc.Metadata)]
}

object GossipFs2GrpcTrailers extends _root_.fs2.grpc.GeneratedCompanion[GossipFs2GrpcTrailers] {
  
  def serviceDescriptor: _root_.io.grpc.ServiceDescriptor = com.eventstore.dbclient.proto.gossip.GossipGrpc.SERVICE
  
  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): GossipFs2GrpcTrailers[F, A] = new GossipFs2GrpcTrailers[F, A] {
    def read(request: com.eventstore.dbclient.proto.shared.Empty, ctx: A): F[(com.eventstore.dbclient.proto.gossip.ClusterInfo, _root_.io.grpc.Metadata)] = {
      mkMetadata(ctx).flatMap { m =>
        _root_.fs2.grpc.client.Fs2ClientCall[F](channel, com.eventstore.dbclient.proto.gossip.GossipGrpc.METHOD_READ, dispatcher, clientOptions).flatMap(_.unaryToUnaryCallTrailers(request, m))
      }
    }
  }
  
  protected def serviceBinding[F[_]: _root_.cats.effect.Async, A](dispatcher: _root_.cats.effect.std.Dispatcher[F], serviceImpl: GossipFs2GrpcTrailers[F, A], mkCtx: _root_.io.grpc.Metadata => F[A], serverOptions: _root_.fs2.grpc.server.ServerOptions): _root_.io.grpc.ServerServiceDefinition = {
    _root_.io.grpc.ServerServiceDefinition
      .builder(com.eventstore.dbclient.proto.gossip.GossipGrpc.SERVICE)
      .addMethod(com.eventstore.dbclient.proto.gossip.GossipGrpc.METHOD_READ, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCallTrailers[com.eventstore.dbclient.proto.shared.Empty, com.eventstore.dbclient.proto.gossip.ClusterInfo]((r, m) => mkCtx(m).flatMap(serviceImpl.read(r, _))))
      .build()
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy