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

chainrpc.ChainNotifierClient.scala Maven / Gradle / Ivy

The newest version!

// Generated by Pekko gRPC. DO NOT EDIT.
package chainrpc

import scala.concurrent.ExecutionContext

import org.apache.pekko
import pekko.actor.ClassicActorSystemProvider

import pekko.grpc.GrpcChannel
import pekko.grpc.GrpcClientCloseException
import pekko.grpc.GrpcClientSettings

import pekko.grpc.scaladsl.PekkoGrpcClient

import pekko.grpc.internal.NettyClientUtils

import pekko.grpc.PekkoGrpcGenerated

import pekko.grpc.scaladsl.StreamResponseRequestBuilder
import pekko.grpc.internal.ScalaServerStreamingRequestBuilder

// Not sealed so users can extend to write their stubs
@PekkoGrpcGenerated
trait ChainNotifierClient extends ChainNotifier with ChainNotifierClientPowerApi with PekkoGrpcClient

@PekkoGrpcGenerated
object ChainNotifierClient {
  def apply(settings: GrpcClientSettings)(implicit sys: ClassicActorSystemProvider): ChainNotifierClient =
    new DefaultChainNotifierClient(GrpcChannel(settings), isChannelOwned = true)
  def apply(channel: GrpcChannel)(implicit sys: ClassicActorSystemProvider): ChainNotifierClient =
    new DefaultChainNotifierClient(channel, isChannelOwned = false)

  private class DefaultChainNotifierClient(channel: GrpcChannel, isChannelOwned: Boolean)(implicit sys: ClassicActorSystemProvider) extends ChainNotifierClient {
    import ChainNotifier.MethodDescriptors._

    private implicit val ex: ExecutionContext = sys.classicSystem.dispatcher
    private val settings = channel.settings
    private val options = NettyClientUtils.callOptions(settings)

    
    private def registerConfirmationsNtfnRequestBuilder(channel: pekko.grpc.internal.InternalChannel) =
    
      
      new ScalaServerStreamingRequestBuilder(registerConfirmationsNtfnDescriptor, channel, options, settings)
      
    
    
    private def registerSpendNtfnRequestBuilder(channel: pekko.grpc.internal.InternalChannel) =
    
      
      new ScalaServerStreamingRequestBuilder(registerSpendNtfnDescriptor, channel, options, settings)
      
    
    
    private def registerBlockEpochNtfnRequestBuilder(channel: pekko.grpc.internal.InternalChannel) =
    
      
      new ScalaServerStreamingRequestBuilder(registerBlockEpochNtfnDescriptor, channel, options, settings)
      
    
    

    
    /**
     * Lower level "lifted" version of the method, giving access to request metadata etc.
     * prefer registerConfirmationsNtfn(chainrpc.ConfRequest) if possible.
     */
    
    override def registerConfirmationsNtfn(): StreamResponseRequestBuilder[chainrpc.ConfRequest, chainrpc.ConfEvent] =
      registerConfirmationsNtfnRequestBuilder(channel.internalChannel)
    

    /**
     * For access to method metadata use the parameterless version of registerConfirmationsNtfn
     */
    def registerConfirmationsNtfn(in: chainrpc.ConfRequest): org.apache.pekko.stream.scaladsl.Source[chainrpc.ConfEvent, org.apache.pekko.NotUsed] =
      registerConfirmationsNtfn().invoke(in)
    
    /**
     * Lower level "lifted" version of the method, giving access to request metadata etc.
     * prefer registerSpendNtfn(chainrpc.SpendRequest) if possible.
     */
    
    override def registerSpendNtfn(): StreamResponseRequestBuilder[chainrpc.SpendRequest, chainrpc.SpendEvent] =
      registerSpendNtfnRequestBuilder(channel.internalChannel)
    

    /**
     * For access to method metadata use the parameterless version of registerSpendNtfn
     */
    def registerSpendNtfn(in: chainrpc.SpendRequest): org.apache.pekko.stream.scaladsl.Source[chainrpc.SpendEvent, org.apache.pekko.NotUsed] =
      registerSpendNtfn().invoke(in)
    
    /**
     * Lower level "lifted" version of the method, giving access to request metadata etc.
     * prefer registerBlockEpochNtfn(chainrpc.BlockEpoch) if possible.
     */
    
    override def registerBlockEpochNtfn(): StreamResponseRequestBuilder[chainrpc.BlockEpoch, chainrpc.BlockEpoch] =
      registerBlockEpochNtfnRequestBuilder(channel.internalChannel)
    

    /**
     * For access to method metadata use the parameterless version of registerBlockEpochNtfn
     */
    def registerBlockEpochNtfn(in: chainrpc.BlockEpoch): org.apache.pekko.stream.scaladsl.Source[chainrpc.BlockEpoch, org.apache.pekko.NotUsed] =
      registerBlockEpochNtfn().invoke(in)
    

    override def close(): scala.concurrent.Future[pekko.Done] =
      if (isChannelOwned) channel.close()
      else throw new GrpcClientCloseException()

    override def closed: scala.concurrent.Future[pekko.Done] = channel.closed()
  }
}

@PekkoGrpcGenerated
trait ChainNotifierClientPowerApi {
  
  /**
   * Lower level "lifted" version of the method, giving access to request metadata etc.
   * prefer registerConfirmationsNtfn(chainrpc.ConfRequest) if possible.
   */
  
  def registerConfirmationsNtfn(): StreamResponseRequestBuilder[chainrpc.ConfRequest, chainrpc.ConfEvent] = ???
  
  
  /**
   * Lower level "lifted" version of the method, giving access to request metadata etc.
   * prefer registerSpendNtfn(chainrpc.SpendRequest) if possible.
   */
  
  def registerSpendNtfn(): StreamResponseRequestBuilder[chainrpc.SpendRequest, chainrpc.SpendEvent] = ???
  
  
  /**
   * Lower level "lifted" version of the method, giving access to request metadata etc.
   * prefer registerBlockEpochNtfn(chainrpc.BlockEpoch) if possible.
   */
  
  def registerBlockEpochNtfn(): StreamResponseRequestBuilder[chainrpc.BlockEpoch, chainrpc.BlockEpoch] = ???
  
  

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy