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

com.twitter.finagle.thrift.ThriftClient.scala Maven / Gradle / Ivy

There is a newer version: 24.2.0
Show newest version
package com.twitter.finagle.thrift

import com.twitter.finagle.thrift.service.{MethodPerEndpointBuilder, ThriftServiceBuilder}

/**
 * Stateless helper methods which wrap a given `ServiceIface` (deprecated) or a
 * given `ServicePerEndpoint` with another type via the given method's implicit Builder.
 */
trait ThriftClient {

  /**
   * Converts from a Service interface (`ServiceIface`) to the
   * method interface (`newIface`).
   */
  @deprecated(
    "Use com.twitter.finagle.ThriftClient#methodPerEndpoint[ServicePerEndpoint, MethodPerEndpoint]",
    "2017-11-13"
  )
  def newMethodIface[ServiceIface, FutureIface](
    serviceIface: ServiceIface
  )(
    implicit builder: MethodIfaceBuilder[ServiceIface, FutureIface]
  ): FutureIface = builder.newMethodIface(serviceIface)

  /**
   * Converts from a Service interface (`ServicePerEndpoint`) to the
   * method interface (`MethodPerEndpoint`).
   */
  def methodPerEndpoint[ServicePerEndpoint, MethodPerEndpoint](
    servicePerEndpoint: ServicePerEndpoint
  )(
    implicit builder: MethodPerEndpointBuilder[ServicePerEndpoint, MethodPerEndpoint]
  ): MethodPerEndpoint = builder.methodPerEndpoint(servicePerEndpoint)

  /**
   * Converts from a Service interface (`ServicePerEndpoint`) to the higher-kinded
   * method interface (`MethodPerEndpoint`).
   */
  @deprecated("Use methodPerEndpoint", "2018-01-12")
  def thriftService[ServicePerEndpoint, ThriftServiceType](
    servicePerEndpoint: ServicePerEndpoint
  )(
    implicit builder: ThriftServiceBuilder[ServicePerEndpoint, ThriftServiceType]
  ): ThriftServiceType = builder.build(servicePerEndpoint)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy