All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finatra.thrift.Controller.scala Maven / Gradle / Ivy

The newest version!
package com.twitter.finatra.thrift

import com.twitter.finagle.Service
import com.twitter.finatra.thrift.internal.ThriftMethodService
import com.twitter.inject.Logging
import com.twitter.scrooge.{ToThriftService, ThriftMethod}
import scala.collection.mutable.ListBuffer

trait Controller extends Logging { self: ToThriftService =>
  private[thrift] val methods = new ListBuffer[ThriftMethodService[_, _]]

  protected def handle[Args, Result](method: ThriftMethod)(f: method.FunctionType)(
    implicit argsEv: =:=[Args, method.Args],
    resultEv: =:=[Result, method.Result],
    svcEv: =:=[method.ServiceType, Service[Args, Result]]): ThriftMethodService[Args, Result] = {
    val thriftMethodService =
      new ThriftMethodService[Args, Result](method, method.functionToService(f))
    methods += thriftMethodService
    thriftMethodService
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy