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 ClientDeserializeCtx[Rep] extends (Array[Byte]) ⇒ ReqRep

    Permalink

    Used by Thrift and ThriftMux Client to facilitate giving the Finagle stack access to various data that are computed outside of Finagle's stack.

    Used by Thrift and ThriftMux Client to facilitate giving the Finagle stack access to various data that are computed outside of Finagle's stack.

    This includes:

    • the deserialized forms of Thrift requests and responses.
    • the name of the rpc.
    • the elapsed time to serialize the request.
    • the elapsed time to deserialize the response.

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

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

    Note

    this class has evolved and it's name is now a bit too specific for its more expanded role.

  2. 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.

  3. abstract class GeneratedThriftService extends AnyRef

    Permalink

    An abstract class that all scrooge-generated thrift service objects inherit directly from, including services that extend other services.

  4. 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.

  5. class MethodMetadata extends AnyRef

    Permalink

    Stores information about the current Thrift method.

    Stores information about the current Thrift method. This information is set in both Java and Scala generated code. It is expected that users will only need to interact with com.twitter.finagle.thrift.MethodMetadata.current to obtain the current MethodMetadata if it has been set.

    See also

    com.twitter.finagle.thrift.MethodMetadata.current

  6. 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.

  7. class RichClientParam extends AnyRef

    Permalink

    Thrift-specific parameters for configuring clients.

  8. case class RichServerParam(protocolFactory: TProtocolFactory = Thrift.param.protocolFactory, serviceName: String = "thrift", maxThriftBufferSize: Int = Thrift.param.maxThriftBufferSize, serverStats: StatsReceiver = LoadedStatsReceiver, responseClassifier: ResponseClassifier = ResponseClassifier.Default, perEndpointStats: Boolean = false) extends Product with Serializable

    Permalink

    Produce a server with params wrapped in RichServerParam

    Produce a server with params wrapped in RichServerParam

    protocolFactory

    A TProtocolFactory creates protocol objects from transports

    serviceName

    For server stats, (default: "thrift")

    maxThriftBufferSize

    The max size of a reusable buffer for the thrift response

    serverStats

    StatsReceiver for recording metrics

    responseClassifier

    See com.twitter.finagle.service.ResponseClassifier

    perEndpointStats

    Whether to record per-endpoint stats, (default: false). By enabling this, the specific Thrift Exceptions can be recorded. See PerEndpoint StatsFilter

  9. 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.

  10. 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.

  11. final class ServerToReqRep extends (Array[Byte]) ⇒ ReqRep

    Permalink

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

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

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

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

  12. trait ThriftClient extends AnyRef

    Permalink

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

  13. class ThriftClientRequest extends AnyRef

    Permalink
  14. case class ThriftMethodStats extends Product with Serializable

    Permalink
  15. trait ThriftRichClient extends AnyRef

    Permalink

    A mixin trait to provide a rich Thrift client API.

  16. trait ThriftRichServer extends AnyRef

    Permalink

    A mixin trait to provide a rich Thrift server API.

  17. trait ThriftService extends AnyRef

    Permalink

    A marker trait that signifies that this is a thrift service that can be served by Finagle

  18. trait ToThriftService extends AnyRef

    Permalink

    A trait that signifies a ThriftService can be created from this

  19. 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.

  20. final class DeserializeCtx[Rep] extends ClientDeserializeCtx[Rep]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 2018-8-13) Use ClientDeserializeCtx.

  21. 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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-13) Use com.twitter.finagle.thrift.service.MethodPerEndpointBuilder

  22. 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.

    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-13) Use com.twitter.finagle.thrift.service.ServicePerEndpointBuilder

Value Members

  1. object ClientDeserializeCtx

    Permalink
  2. object Headers

    Permalink
  3. object InputBuffers

    Permalink
  4. object MethodMetadata

    Permalink

    A com.twitter.finagle.context.LocalContext Key for a stored com.twitter.finagle.thrift.MethodMetadata along with an accessor method for retrieving the currently set value.

  5. object Protocols

    Permalink
  6. object RichClientParam

    Permalink
  7. object SeqIdFilter

    Permalink
  8. object ServerToReqRep

    Permalink
  9. object ThriftMethodStats extends Serializable

    Permalink
  10. package exp

    Permalink
  11. object maxReusableBufferSize extends GlobalFlag[StorageUnit]

    Permalink
  12. package service

    Permalink
  13. package thrift

    Permalink
  14. package thriftscala

    Permalink

Deprecated Value Members

  1. object DeserializeCtx

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 2018-8-13) Use ClientDeserializeCtx.

Inherited from AnyRef

Inherited from Any

Ungrouped