peersrpc.PeersClient.scala Maven / Gradle / Ivy
The newest version!
// Generated by Pekko gRPC. DO NOT EDIT.
package peersrpc
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.SingleResponseRequestBuilder
import pekko.grpc.internal.ScalaUnaryRequestBuilder
// Not sealed so users can extend to write their stubs
@PekkoGrpcGenerated
trait PeersClient extends Peers with PeersClientPowerApi with PekkoGrpcClient
@PekkoGrpcGenerated
object PeersClient {
def apply(settings: GrpcClientSettings)(implicit sys: ClassicActorSystemProvider): PeersClient =
new DefaultPeersClient(GrpcChannel(settings), isChannelOwned = true)
def apply(channel: GrpcChannel)(implicit sys: ClassicActorSystemProvider): PeersClient =
new DefaultPeersClient(channel, isChannelOwned = false)
private class DefaultPeersClient(channel: GrpcChannel, isChannelOwned: Boolean)(implicit sys: ClassicActorSystemProvider) extends PeersClient {
import Peers.MethodDescriptors._
private implicit val ex: ExecutionContext = sys.classicSystem.dispatcher
private val settings = channel.settings
private val options = NettyClientUtils.callOptions(settings)
private def updateNodeAnnouncementRequestBuilder(channel: pekko.grpc.internal.InternalChannel) =
new ScalaUnaryRequestBuilder(updateNodeAnnouncementDescriptor, channel, options, settings)
/**
* Lower level "lifted" version of the method, giving access to request metadata etc.
* prefer updateNodeAnnouncement(peersrpc.NodeAnnouncementUpdateRequest) if possible.
*/
override def updateNodeAnnouncement(): SingleResponseRequestBuilder[peersrpc.NodeAnnouncementUpdateRequest, peersrpc.NodeAnnouncementUpdateResponse] =
updateNodeAnnouncementRequestBuilder(channel.internalChannel)
/**
* For access to method metadata use the parameterless version of updateNodeAnnouncement
*/
def updateNodeAnnouncement(in: peersrpc.NodeAnnouncementUpdateRequest): scala.concurrent.Future[peersrpc.NodeAnnouncementUpdateResponse] =
updateNodeAnnouncement().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 PeersClientPowerApi {
/**
* Lower level "lifted" version of the method, giving access to request metadata etc.
* prefer updateNodeAnnouncement(peersrpc.NodeAnnouncementUpdateRequest) if possible.
*/
def updateNodeAnnouncement(): SingleResponseRequestBuilder[peersrpc.NodeAnnouncementUpdateRequest, peersrpc.NodeAnnouncementUpdateResponse] = ???
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy