Package

com.twitter.finagle

thrift

Permalink

package thrift

Deprecation

Please use the new interface, com.twitter.finagle.Thrift, for constructing Thrift clients and servers.

Thrift codecs

We provide client and server protocol support for the framed protocol. The public implementations are defined on the Thrift object:

The type of the server codec is Service[Array[Byte], Array[Byte]] and the client codecs are Service[ThriftClientRequest, Array[Byte]]. The service provided is that of a "transport" of thrift messages (requests and replies) according to the protocol chosen. This is why the client codecs need to have access to a thrift ProtocolFactory.

These transports are used by the services produced by the finagle thrift codegenerator.

val service: Service[ThriftClientRequest, Array[Byte]] = ClientBuilder()
  .hosts("foobar.com:123")
  .stack(Thrift.client)
  .build()

// Wrap the raw Thrift transport in a Client decorator. The client
// provides a convenient procedural interface for accessing the Thrift
// server.
val client = new Hello.ServiceToClient(service, protocolFactory)

In this example, Hello is the thrift interface, and the inner class ServiceToClient is provided by the finagle thrift code generator.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. thrift
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class ClientIdRequiredFilter[Req, Rep] extends SimpleFilter[Req, Rep]

    Permalink

    A Filter for Thrift services that enforces all requests specify a com.twitter.finagle.thrift.ClientId.

  2. class DeserializeCtx[Rep] extends AnyRef

    Permalink

    Used by Thrift and ThriftMux to facilitate giving the Finagle stack access to the deserialized forms of Thrift requests and responses.

    Used by Thrift and ThriftMux to facilitate giving the Finagle stack access to the deserialized forms of Thrift requests and responses.

    When using Scrooge for code generation, a proper DeserializationCtx will be available to code via Contexts.local(DeserializeCtx.Key).

    While this is thread-safe, it should only be used for the life of a single request/response pair.

  3. case class InvalidThriftConnectionException() extends Exception with ServiceException with Product with Serializable

    Permalink

    Indicates that the connection on which a Thrift request was issued is invalid, where "validity" is determined by com.twitter.finagle.thrift.ValidateThriftService.

  4. trait MethodIfaceBuilder[ServiceIface, MethodIface] extends AnyRef

    Permalink

    A typeclass to construct a MethodIface by wrapping a ServiceIface.

    A typeclass to construct a MethodIface by wrapping a ServiceIface. This is a compatibility constructor to replace an existing Future interface with one built from a ServiceIface.

    Scrooge generates implementations of this builder.

  5. class NoClientIdSpecifiedException extends RequestException

    Permalink

    Indicates that a request without a com.twitter.finagle.thrift.ClientId was issued to a server that requires them.

    Indicates that a request without a com.twitter.finagle.thrift.ClientId was issued to a server that requires them. See com.twitter.finagle.thrift.ClientIdRequiredFilter for details.

  6. class SeqIdFilter extends SimpleFilter[ThriftClientRequest, Array[Byte]]

    Permalink

    A Filter that overrides Thrift request sequence IDs, replacing them with our own randomly-assigned i32s.

    A Filter that overrides Thrift request sequence IDs, replacing them with our own randomly-assigned i32s. Upon response receipt, this filter ensures that responses have the correct corresponding sequence ID, failing any requests that do not.

    Note

    This only works when using BinaryProtocol.

  7. case class SeqMismatchException(id: Int, expected: Int) extends TransportException with Product with Serializable

    Permalink

    Indicates that a Thrift response did not have the correct sequence ID according to that assigned by com.twitter.finagle.thrift.SeqIdFilter on the corresponding request.

  8. trait ServiceIfaceBuilder[ServiceIface <: Filterable[ServiceIface]] extends AnyRef

    Permalink

    Typeclass ServiceIfaceBuilder[T] creates T-typed interfaces from thrift clients.

    Typeclass ServiceIfaceBuilder[T] creates T-typed interfaces from thrift clients. Scrooge generates implementations of this builder.

  9. class ThriftClientRequest extends AnyRef

    Permalink
  10. case class ThriftMethodStats(requestsCounter: Counter, successCounter: Counter, failuresCounter: Counter, failuresScope: StatsReceiver) extends Product with Serializable

    Permalink
  11. class ValidateThriftService extends ServiceProxy[ThriftClientRequest, Array[Byte]]

    Permalink

    A filter that invalidates a connection if it suffers from an irrecoverable application exception.

    A filter that invalidates a connection if it suffers from an irrecoverable application exception.

    Amazingly, an Apache Thrift server will leave a connection in a bad state without closing it, and furthermore only expose such errors as an "application" exception.

    All we can do is sigh, pinch our noses, and apply ValidateThriftService.

  12. class ThriftClientFramedCodec extends Codec[ThriftClientRequest, Array[Byte]]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 2016-12-01) Use the com.twitter.finagle.Thrift object to build a client

  13. class ThriftClientFramedCodecFactory extends (ClientCodecConfig) ⇒ Codec[ThriftClientRequest, Array[Byte]]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 2016-12-01) Use the com.twitter.finagle.Thrift object to build a client

  14. class ThriftServerFramedCodec extends Codec[Array[Byte], Array[Byte]]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-02-10) Use the com.twitter.finagle.Thrift object to build a server

  15. class ThriftServerFramedCodecFactory extends (ServerCodecConfig) ⇒ Codec[Array[Byte], Array[Byte]]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-02-10) Use the com.twitter.finagle.Thrift object to build a server

Value Members

  1. object DeserializeCtx

    Permalink
  2. object InputBuffers

    Permalink
  3. object Protocols

    Permalink
  4. object SeqIdFilter

    Permalink
  5. object ThriftMethodStats extends Serializable

    Permalink
  6. object ThriftServiceIface

    Permalink

    Construct Service interface for a Thrift method.

    Construct Service interface for a Thrift method.

    There are two ways to use a Scrooge-generated Thrift Service with Finagle:

    1. Using a Service interface, i.e. a collection of Finagle Services.

    2. Using a method interface, i.e. a collection of methods returning Futures.

    Example: for a Thrift service IDL:

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    the Service interface, or ServiceIface, is

    trait LoggerServiceIface {
      val log: com.twitter.finagle.Service[Logger.Log.Args, Logger.Log.SuccessType]
      val getLogSize: com.twitter.finagle.Service[Logger.GetLogSize.Args, Logger.GetLogSize.SuccessType]
    }

    and the method interface, or MethodIface, is

    trait Logger[Future] {
      def log(message: String, logLevel: Int): Future[String]
      def getLogSize(): Future[Int]
    }

    Service interfaces can be modified and composed with Finagle Filters.

  7. object maxReusableBufferSize extends GlobalFlag[StorageUnit]

    Permalink
  8. package service

    Permalink
  9. package thrift

    Permalink
  10. package thriftscala

    Permalink
  11. package transport

    Permalink

Deprecated Value Members

  1. object ThriftClientFramedCodec

    Permalink

    ThriftClientFramedCodec implements a framed thrift transport that supports upgrading in order to provide TraceContexts across requests.

    ThriftClientFramedCodec implements a framed thrift transport that supports upgrading in order to provide TraceContexts across requests.

    Annotations
    @deprecated
    Deprecated

    (Since version 2016-12-01) Use the com.twitter.finagle.Thrift object to build a client

  2. object ThriftServerFramedCodec

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-02-10) Use the com.twitter.finagle.Thrift object to build a server

Inherited from AnyRef

Inherited from Any

Ungrouped