-
Notifications
You must be signed in to change notification settings - Fork 244
/
service.scala
65 lines (58 loc) · 1.96 KB
/
service.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package {{package}}
import com.twitter.scrooge.{
TFieldBlob, ThriftService, ThriftStruct, ThriftStructCodec, ThriftStructCodec3, ThriftStructFieldInfo, ThriftUtil}
import java.nio.ByteBuffer
import java.util.Arrays
import org.apache.thrift.protocol._
import org.apache.thrift.transport.TTransport
import org.apache.thrift.TApplicationException
import org.apache.thrift.transport.TMemoryBuffer
import scala.collection.immutable.{Map => immutable$Map}
import scala.collection.mutable.{
Builder,
ArrayBuffer => mutable$ArrayBuffer, Buffer => mutable$Buffer,
HashMap => mutable$HashMap, HashSet => mutable$HashSet}
import scala.collection.{Map, Set}
{{docstring}}
@javax.annotation.Generated(value = Array("com.twitter.scrooge.Compiler"))
trait {{ServiceName}}[+MM[_]] {{#genericParent}}extends {{genericParent}} {{/genericParent}}{
{{#genericFunctions}}
{{>function}}
{{/genericFunctions}}
}
{{docstring}}
object {{ServiceName}} {
{{#internalStructs}}
{{#internalArgsStruct}}
{{>struct}}
{{/internalArgsStruct}}
{{#internalResultStruct}}
{{>struct}}
{{/internalResultStruct}}
{{/internalStructs}}
{{#withFinagle}}
import com.twitter.util.Future
trait FutureIface extends {{#futureIfaceParent}}{{futureIfaceParent}} with{{/futureIfaceParent}} {{ServiceName}}[Future] {
{{#asyncFunctions}}
{{>function}}
{{/asyncFunctions}}
}
class FinagledClient(
service: com.twitter.finagle.Service[com.twitter.finagle.thrift.ThriftClientRequest, Array[Byte]],
protocolFactory: TProtocolFactory = new TBinaryProtocol.Factory,
serviceName: String = "",
stats: com.twitter.finagle.stats.StatsReceiver = com.twitter.finagle.stats.NullStatsReceiver)
extends {{ServiceName}}$FinagleClient(
service,
protocolFactory,
serviceName,
stats)
with FutureIface
class FinagledService(
iface: FutureIface,
protocolFactory: TProtocolFactory)
extends {{ServiceName}}$FinagleService(
iface,
protocolFactory)
{{/withFinagle}}
}