p

com.twitter

scrooge

package scrooge

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

Package Members

  1. package adapt
  2. package internal
  3. package thrift_validation
  4. package validation

Type Members

  1. trait EnumItemUnknown extends ThriftEnum

    Base class for unknown enum items.

    Base class for unknown enum items. The implementations are used for backward compatibility during enum update at producer.

  2. trait HasThriftStructCodec3[T <: ThriftStruct] extends AnyRef
  3. class HeaderMap extends AnyRef

    Immutable Map of Header Keys Strings to Seq of Header Buf Values.

  4. final class InvalidFieldsException extends Exception

    An exception used to communicate when the fields on a struct are set incorrectly and the struct cannot be built because of it.

  5. trait LazyTProtocol extends TProtocol

    An extension to the TProtocol to enable lazy reading

    An extension to the TProtocol to enable lazy reading

    Three main classes of operations are intended to be enabled here:

    1) Enable caching of a backing Array[Byte] so we can serialize quickly what we just deserialized if unchanged. 2) Enabling deferred string decoding, since string decoding is an expensive operation if we don't need the string large savings can be had avoiding this for all strings in our deserialization path. 3) Optional fields require boxing + allocations during deserialization for primitive types, this stores the offset to those types instead, doing a lazy instantiation of the Option when the field is first accessed.

  6. case class ProtocolExceptionResponse[In, Out](input: In, response: Buf, exception: TApplicationException) extends RichResponse[In, Out] with Product with Serializable

    A ProtocolExceptionResponse represents a response which throws a thrift application exception of protocol error.

    A ProtocolExceptionResponse represents a response which throws a thrift application exception of protocol error.

    exception

    a TApplicationException of protocol error

    Note

    while this is a public API, it is only intended for use by the generated code.

  7. class Request[+Args <: ThriftStruct] extends AnyRef
  8. class Response[+SuccessType] extends AnyRef
  9. sealed trait RichResponse[In, Out] extends AnyRef

    A RichResponse tells filters richer information of a response, including the corresponding request, intermediate forms of the response and final response in byte buffer.

    A RichResponse tells filters richer information of a response, including the corresponding request, intermediate forms of the response and final response in byte buffer.

    In

    type of the request

    Out

    intermediate form of the response

  10. abstract class StructBuilder[T <: ThriftStruct] extends AnyRef

    A class that provides an interface for building a new ThriftStruct from an existing ThriftStruct or statically from T.

    A class that provides an interface for building a new ThriftStruct from an existing ThriftStruct or statically from T.

    We pass in a list of ClassTags which describe each of the struct's field types so that we can validate the values we are setting at runtime.

  11. trait StructBuilderFactory[T <: ThriftStruct] extends AnyRef

    A trait that provides an interface for building a new StructBuilder[T].

    A trait that provides an interface for building a new StructBuilder[T].

    When added to the companion object, it makes it possible to create a T statically without needing to call newBuilder() on an instance. For example, calling Struct.newBuilder(). In this case, there will be no default values set for each field, making it necessary for the caller to set all the fields in the struct.

  12. case class SuccessfulResponse[In, Out](input: In, response: Buf, result: Out) extends RichResponse[In, Out] with Product with Serializable

    A SuccessfulResponse represents a successful response.

    A SuccessfulResponse represents a successful response.

    result

    a result contains deserialized successful response

    Note

    while this is a public API, it is only intended for use by the generated code.

  13. final class TArrayByteTransport extends TTransport
  14. case class TFieldBlob(field: TField, content: Buf) extends Product with Serializable

    This class encapsulates a TField reference with a TCompactProtocol-encoded binary blob.

  15. class TLazyBinaryProtocol extends TBinaryProtocol with LazyTProtocol
  16. case class TReusableBuffer(initialSize: Int = 512, maxThriftBufferSize: Int = 16 * 1024) extends Product with Serializable

    This is a per-thread managed resource and must be reset after use

    This is a per-thread managed resource and must be reset after use

    import com.twitter.scrooge.TReusableBuffer
    
    class Example {
      private[this] val reusableBuffer = new TReusableBuffer()
    
      def someMethod(): Unit = {
        val buffer = reusableBuffer.get()
        try {
          // code that uses buffer
        } finally {
          buffer.reset()
        }
      }
    }
    initialSize

    The initial buffer size, default is 512.

    maxThriftBufferSize

    The buffer will reset if it exceeds max buffer size, default is 16K.

  17. class TReusableMemoryTransport extends TTransport

    A version of TMemoryTransport that allows for reuse in order to minimize object allocations.

  18. trait ThriftEnum extends TEnum
  19. trait ThriftEnumObject[T <: ThriftEnum] extends AnyRef
  20. trait ThriftException extends Exception
  21. case class ThriftExceptionResponse[In, Out](input: In, response: Buf, ex: ThriftException) extends RichResponse[In, Out] with Product with Serializable

    A ThriftExceptionResponse represents a response which throws thrift application exceptions defined in IDL.

    A ThriftExceptionResponse represents a response which throws thrift application exceptions defined in IDL.

    ex

    the thrift application exception

    Note

    while this is a public API, it is only intended for use by the generated code.

  22. trait ThriftMethod extends ThriftMethodIface

    Metadata for a method for a Thrift service.

    Metadata for a method for a Thrift service.

    Comments below will use this example IDL:

    service ExampleService {
      i32 boringMethod(
        1: i32 input1,
        2: string input2
      )
    }
  23. abstract class ThriftMethodIface extends AnyRef

    Abstract ThriftMethod interface for Java thrift methods.

  24. trait ThriftResponse[Result] extends AnyRef
  25. trait ThriftStruct extends ThriftStructIface
  26. trait ThriftStructCodec[T <: ThriftStruct] extends AnyRef

    A trait encapsulating the logic for encoding and decoding a specific thrift struct type.

  27. abstract class ThriftStructCodec3[T <: ThriftStruct] extends ThriftStructCodec[T]

    Introduced as a backwards compatible API bridge in Scrooge 3.

    Introduced as a backwards compatible API bridge in Scrooge 3. Scala generated structs extend from this class.

    See also

    ThriftStructCodec

  28. abstract class ThriftStructField[T <: ThriftStruct] extends AnyRef

    Field information and a generic way to access the field value.

    Field information and a generic way to access the field value. The ThriftStructField is defined in the generated struct's companion object in order to avoid using reflection to access the field value. If the struct is being created in another way (i.e. not generated through scrooge) the fields will be defined via reflection in PopulateMetaDataWithReflection.getFieldsWithReflection.

  29. final class ThriftStructFieldInfo extends AnyRef

    Field information to be embedded in a generated struct's companion class.

    Field information to be embedded in a generated struct's companion class. Allows for reflection on field types.

  30. trait ThriftStructIface extends AnyRef
  31. trait ThriftStructMetaData[T <: ThriftStruct] extends AnyRef

    A trait for generic introspection on ThriftStruct classes.

  32. trait ThriftUnion extends AnyRef

    Unions are tagged with this trait as well as with ThriftStruct.

  33. final class ThriftUnionFieldInfo[UnionFieldType <: ThriftUnion with ThriftStruct, ContainedType] extends AnyRef

    Field information to be embedded in a generated union's companion class.

    Field information to be embedded in a generated union's companion class.

    UnionFieldType

    The type of the union field represented by this class

    ContainedType

    The type of the value contained in the union field represented by this class

  34. final class UtilValidator extends BaseValidator

    An implementation of BaseValidator that leverage com.twitter.util.validation.ScalaValidator to perform validations against DefaultAnnotations.

    An implementation of BaseValidator that leverage com.twitter.util.validation.ScalaValidator to perform validations against DefaultAnnotations.

    Note

    This class is only used for Scrooge internally.

  35. trait ValidatingThriftStruct[T <: ThriftStruct] extends ThriftStruct with HasThriftStructCodec3[T]

    This trait extends from HasThriftStructCodec3 and ThriftStruct.

    This trait extends from HasThriftStructCodec3 and ThriftStruct. It should be safe to call "validatingStruct._codec.validateNewInstance(validatingStruct)" on any validatingStruct that implements ValidatingThriftStruct. We take advantage of this fact in the validateField method in ValidatingThriftStructCodec3.

    A method could be added to this trait that does this (with more type safety), but we want to avoid adding unnecessary methods to thrift structs.

  36. abstract class ValidatingThriftStructCodec3[T <: ThriftStruct] extends ThriftStructCodec3[T]

Value Members

  1. val AsClosableMethodName: String

    A string representing reserved method name asClosable

  2. object Request
  3. object Response
  4. object TArrayByteTransport

    TArrayByteTransport decodes Array[Byte] to primitive types This is a replacement transport optimized for Array[Byte] and the TLazyBinaryProtocol

    TArrayByteTransport decodes Array[Byte] to primitive types This is a replacement transport optimized for Array[Byte] and the TLazyBinaryProtocol

    NB. This class/transport is not thread safe, and contains mutable state.

  5. object TFieldBlob extends Serializable
  6. object TLazyBinaryProtocol

    This is an implementation of the LazyTProtocol trait in scrooge-core This is not thread safe and maintains state.

    This is an implementation of the LazyTProtocol trait in scrooge-core This is not thread safe and maintains state. It also heavily uses inline annotations and marks things as final where possible to avoid virtual indirects. Its in a benchmark package as a POC, we may want to do something a bit different when it comes to a version for scrooge-serializer or elsewhere. Though it is a fully functional protocol that will deserialize/serialize any thrift.

  7. object TReusableMemoryTransport
  8. object ThriftResponse
  9. object ThriftStruct
  10. object ThriftStructMetaData
  11. object ThriftUtil
  12. object UtilValidator
  13. object ValidatingThriftStructCodec3

Inherited from AnyRef

Inherited from Any

Ungrouped