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

xyz.stratalab.indexer.services.NetworkMetricsServiceFs2Grpc.scala Maven / Gradle / Ivy

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

import _root_.cats.syntax.all._

trait NetworkMetricsServiceFs2Grpc[F[_], A] {
  def getTxoStats(request: xyz.stratalab.indexer.services.GetTxoStatsReq, ctx: A): F[xyz.stratalab.indexer.services.GetTxoStatsRes]
  def getBlockchainSizeStats(request: xyz.stratalab.indexer.services.BlockchainSizeStatsReq, ctx: A): F[xyz.stratalab.indexer.services.BlockchainSizeStatsRes]
  def getBlockStats(request: xyz.stratalab.indexer.services.BlockStatsReq, ctx: A): F[xyz.stratalab.indexer.services.BlockStatsRes]
}

object NetworkMetricsServiceFs2Grpc extends _root_.fs2.grpc.GeneratedCompanion[NetworkMetricsServiceFs2Grpc] {
  
  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): NetworkMetricsServiceFs2Grpc[F, A] = new NetworkMetricsServiceFs2Grpc[F, A] {
    def getTxoStats(request: xyz.stratalab.indexer.services.GetTxoStatsReq, ctx: A): F[xyz.stratalab.indexer.services.GetTxoStatsRes] = {
      mkMetadata(ctx).flatMap { m =>
        _root_.fs2.grpc.client.Fs2ClientCall[F](channel, xyz.stratalab.indexer.services.NetworkMetricsServiceGrpc.METHOD_GET_TXO_STATS, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(request, m))
      }
    }
    def getBlockchainSizeStats(request: xyz.stratalab.indexer.services.BlockchainSizeStatsReq, ctx: A): F[xyz.stratalab.indexer.services.BlockchainSizeStatsRes] = {
      mkMetadata(ctx).flatMap { m =>
        _root_.fs2.grpc.client.Fs2ClientCall[F](channel, xyz.stratalab.indexer.services.NetworkMetricsServiceGrpc.METHOD_GET_BLOCKCHAIN_SIZE_STATS, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(request, m))
      }
    }
    def getBlockStats(request: xyz.stratalab.indexer.services.BlockStatsReq, ctx: A): F[xyz.stratalab.indexer.services.BlockStatsRes] = {
      mkMetadata(ctx).flatMap { m =>
        _root_.fs2.grpc.client.Fs2ClientCall[F](channel, xyz.stratalab.indexer.services.NetworkMetricsServiceGrpc.METHOD_GET_BLOCK_STATS, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(request, m))
      }
    }
  }
  
  protected def serviceBinding[F[_]: _root_.cats.effect.Async, A](dispatcher: _root_.cats.effect.std.Dispatcher[F], serviceImpl: NetworkMetricsServiceFs2Grpc[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.indexer.services.NetworkMetricsServiceGrpc.SERVICE)
      .addMethod(xyz.stratalab.indexer.services.NetworkMetricsServiceGrpc.METHOD_GET_TXO_STATS, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCall[xyz.stratalab.indexer.services.GetTxoStatsReq, xyz.stratalab.indexer.services.GetTxoStatsRes]((r, m) => mkCtx(m).flatMap(serviceImpl.getTxoStats(r, _))))
      .addMethod(xyz.stratalab.indexer.services.NetworkMetricsServiceGrpc.METHOD_GET_BLOCKCHAIN_SIZE_STATS, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCall[xyz.stratalab.indexer.services.BlockchainSizeStatsReq, xyz.stratalab.indexer.services.BlockchainSizeStatsRes]((r, m) => mkCtx(m).flatMap(serviceImpl.getBlockchainSizeStats(r, _))))
      .addMethod(xyz.stratalab.indexer.services.NetworkMetricsServiceGrpc.METHOD_GET_BLOCK_STATS, _root_.fs2.grpc.server.Fs2ServerCallHandler[F](dispatcher, serverOptions).unaryToUnaryCall[xyz.stratalab.indexer.services.BlockStatsReq, xyz.stratalab.indexer.services.BlockStatsRes]((r, m) => mkCtx(m).flatMap(serviceImpl.getBlockStats(r, _))))
      .build()
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy