com.twitter.finagle

thrift

package thrift

Deprecation

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

Thrift codecs

We provide both framed and buffered client protocol support, and server support for the framed protocol. The public implementations are:

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")
  .codec(ThriftClientFramedCodec())
  .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
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. thrift
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class ClientId(name: String) extends Product with Serializable

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

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

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

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

  4. class NoClientIdSpecifiedException extends RequestException

    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.

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

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

    A com.twitter.finagle.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.

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

    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.

  7. class ThriftCall[A <: TBase[_, _], R <: TBase[_, _]] extends AnyRef

    The ThriftCall object represents a thrift dispatch on the channel.

    The ThriftCall object represents a thrift dispatch on the channel. The method name & argument thrift structure (POJO) is given.

  8. class ThriftCallFactory[A <: TBase[_, _], R <: TBase[_, _]] extends AnyRef

  9. class ThriftClientBufferedCodec extends ThriftClientFramedCodec

  10. class ThriftClientBufferedCodecFactory extends (ClientCodecConfig) ⇒ Codec[ThriftClientRequest, Array[Byte]]

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

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

  13. class ThriftClientRequest extends AnyRef

  14. case class ThriftReply[R <: TBase[_, _]](response: R, call: ThriftCall[_ <: TBase[_, _], _ <: TBase[_, _]]) extends Product with Serializable

    Encapsulates the result of a call to a Thrift service.

  15. class ThriftServerBufferedCodec extends ThriftServerFramedCodec

  16. class ThriftServerBufferedCodecFactory extends (ServerCodecConfig) ⇒ Codec[Array[Byte], Array[Byte]]

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

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

  19. class ValidateThriftService extends ServiceProxy[ThriftClientRequest, Array[Byte]]

    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.

Value Members

  1. object ClientId extends Serializable

    ClientId provides the client identification of the incoming request if available.

    ClientId provides the client identification of the incoming request if available. It is set at the beginning of the request and is available throughout the life-cycle of the request. It is iff the client has an upgraded finagle connection and has chosen to specify the client ID in their codec.

  2. object InputBuffers

  3. object Protocols

  4. object SeqIdFilter

  5. object ThriftClientBufferedCodec

    ThriftClientBufferedCodec implements a buffered thrift transport that supports upgrading in order to provide TraceContexts across requests.

  6. object ThriftClientFramedCodec

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

  7. object ThriftServerBufferedCodec

    ThriftServerBufferedCodec implements a buffered thrift transport.

  8. object ThriftServerFramedCodec

  9. object ThriftTypes extends HashMap[String, ThriftCallFactory[_, _]]

    A registry for Thrift types.

    A registry for Thrift types. Register ThriftCallFactory instances encapsulating the types to be decoded by the ThriftServerCodec with this singleton.

    Server and client codecs will use these types for marshalling.

  10. package thrift

Inherited from AnyRef

Inherited from Any

Ungrouped