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

lnrpc.StateClient.scala Maven / Gradle / Ivy

The newest version!

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

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
import pekko.grpc.scaladsl.SingleResponseRequestBuilder
import pekko.grpc.internal.ScalaUnaryRequestBuilder

// Not sealed so users can extend to write their stubs
@PekkoGrpcGenerated
trait StateClient extends State with StateClientPowerApi with PekkoGrpcClient

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

  private class DefaultStateClient(channel: GrpcChannel, isChannelOwned: Boolean)(implicit sys: ClassicActorSystemProvider) extends StateClient {
    import State.MethodDescriptors._

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

    
    private def subscribeStateRequestBuilder(channel: pekko.grpc.internal.InternalChannel) =
    
      
      new ScalaServerStreamingRequestBuilder(subscribeStateDescriptor, channel, options, settings)
      
    
    
    private def getStateRequestBuilder(channel: pekko.grpc.internal.InternalChannel) =
    
      new ScalaUnaryRequestBuilder(getStateDescriptor, channel, options, settings)
    
    

    
    /**
     * Lower level "lifted" version of the method, giving access to request metadata etc.
     * prefer subscribeState(lnrpc.SubscribeStateRequest) if possible.
     */
    
    override def subscribeState(): StreamResponseRequestBuilder[lnrpc.SubscribeStateRequest, lnrpc.SubscribeStateResponse] =
      subscribeStateRequestBuilder(channel.internalChannel)
    

    /**
     * For access to method metadata use the parameterless version of subscribeState
     */
    def subscribeState(in: lnrpc.SubscribeStateRequest): org.apache.pekko.stream.scaladsl.Source[lnrpc.SubscribeStateResponse, org.apache.pekko.NotUsed] =
      subscribeState().invoke(in)
    
    /**
     * Lower level "lifted" version of the method, giving access to request metadata etc.
     * prefer getState(lnrpc.GetStateRequest) if possible.
     */
    
    override def getState(): SingleResponseRequestBuilder[lnrpc.GetStateRequest, lnrpc.GetStateResponse] =
      getStateRequestBuilder(channel.internalChannel)
    

    /**
     * For access to method metadata use the parameterless version of getState
     */
    def getState(in: lnrpc.GetStateRequest): scala.concurrent.Future[lnrpc.GetStateResponse] =
      getState().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 StateClientPowerApi {
  
  /**
   * Lower level "lifted" version of the method, giving access to request metadata etc.
   * prefer subscribeState(lnrpc.SubscribeStateRequest) if possible.
   */
  
  def subscribeState(): StreamResponseRequestBuilder[lnrpc.SubscribeStateRequest, lnrpc.SubscribeStateResponse] = ???
  
  
  /**
   * Lower level "lifted" version of the method, giving access to request metadata etc.
   * prefer getState(lnrpc.GetStateRequest) if possible.
   */
  
  def getState(): SingleResponseRequestBuilder[lnrpc.GetStateRequest, lnrpc.GetStateResponse] = ???
  
  

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy