package scrooge
- Alphabetic
- By Inheritance
- scrooge
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package adapt
- package internal
- package thrift_validation
- package validation
Type Members
- 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.
- trait HasThriftStructCodec3[T <: ThriftStruct] extends AnyRef
- class HeaderMap extends AnyRef
Immutable Map of Header Keys Strings to Seq of Header
Buf
Values. - 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.
- 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.
- 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.
- class Request[+Args <: ThriftStruct] extends AnyRef
- class Response[+SuccessType] extends AnyRef
- 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
- 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.
- 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, callingStruct.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. - 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.
- final class TArrayByteTransport extends TTransport
- case class TFieldBlob(field: TField, content: Buf) extends Product with Serializable
This class encapsulates a TField reference with a TCompactProtocol-encoded binary blob.
- class TLazyBinaryProtocol extends TBinaryProtocol with LazyTProtocol
- 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.
- class TReusableMemoryTransport extends TTransport
A version of TMemoryTransport that allows for reuse in order to minimize object allocations.
- trait ThriftEnum extends TEnum
- trait ThriftEnumObject[T <: ThriftEnum] extends AnyRef
- trait ThriftException extends Exception
- 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.
- 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 ) }
- abstract class ThriftMethodIface extends AnyRef
Abstract
ThriftMethod
interface for Java thrift methods. - trait ThriftResponse[Result] extends AnyRef
- trait ThriftStruct extends ThriftStructIface
- trait ThriftStructCodec[T <: ThriftStruct] extends AnyRef
A trait encapsulating the logic for encoding and decoding a specific thrift struct type.
- 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
- 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.
- 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.
- trait ThriftStructIface extends AnyRef
- trait ThriftStructMetaData[T <: ThriftStruct] extends AnyRef
A trait for generic introspection on ThriftStruct classes.
- trait ThriftUnion extends AnyRef
Unions are tagged with this trait as well as with ThriftStruct.
- 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
- 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.
- 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.
- abstract class ValidatingThriftStructCodec3[T <: ThriftStruct] extends ThriftStructCodec3[T]
Value Members
- val AsClosableMethodName: String
A string representing reserved method name
asClosable
- object Request
- object Response
- 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.
- object TFieldBlob extends Serializable
- 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.
- object TReusableMemoryTransport
- object ThriftResponse
- object ThriftStruct
- object ThriftStructMetaData
- object ThriftUtil
- object UtilValidator
- object ValidatingThriftStructCodec3