Skip to content

Commit

Permalink
More cleanup, documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bierbaum committed Nov 12, 2010
1 parent efee9a9 commit 8caa347
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/main/scala/com/twitter/finagle/thrift/ThriftCodec.scala
Expand Up @@ -14,15 +14,6 @@ import com.twitter.finagle.channel.TooManyDicksOnTheDanceFloorException

import ChannelBufferConversions._

class ThriftCallFactory[A <: TBase[_], R <: TBase[_]](
val method: String,
argClass: Class[A],
replyClass: Class[R])
{
private[this] def newArgInstance() = argClass.newInstance
def newInstance() = new ThriftCall(method, newArgInstance(), replyClass)
}

/**
* The ThriftCall object represents a thrift dispatch on the
* channel. The method name & argument thrift structure (POJO) is
Expand Down Expand Up @@ -76,10 +67,26 @@ class ThriftCall[A <: TBase[_], R <: TBase[_]](
def arguments: A = args.asInstanceOf[A]
}

/**
* Encapsulates the result of a call to a Thrift service.
*/
case class ThriftReply[R <: TBase[_]](
response: R,
call: ThriftCall[_ <: TBase[_], _ <: TBase[_]])

class ThriftCallFactory[A <: TBase[_], R <: TBase[_]](
val method: String,
argClass: Class[A],
replyClass: Class[R])
{
private[this] def newArgInstance() = argClass.newInstance
def newInstance() = new ThriftCall(method, newArgInstance(), replyClass)
}

/**
* A registry for Thrift types. Register ThriftCallFactory instances encapsulating
* the types to be decoded by the ThriftServerCodec with this singleton.
*/
object ThriftTypes
extends scala.collection.mutable.HashMap[String, ThriftCallFactory[_, _]]
{
Expand Down

0 comments on commit 8caa347

Please sign in to comment.