Skip to content

Commit 3e0915a

Browse files
committed
cleanup
1 parent c68cc1a commit 3e0915a

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

commons-akka/src/main/scala/com/avsystem/commons/rpc/akka/AkkaRPCFramework.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.avsystem.commons.serialization.GenCodec
1616
*/
1717
object AkkaRPCFramework extends GetterRPCFramework with ProcedureRPCFramework with FunctionRPCFramework with MonixRPCFramework {
1818
trait RawRPC extends GetterRawRPC with ProcedureRawRPC with FunctionRawRPC with MonixRawRPC
19+
abstract class FullRPCInfo[T] extends BaseFullRPCInfo[T]
1920

2021
type RawValue = ByteString
2122

commons-macros/src/main/scala/com/avsystem/commons/macros/rpc/RPCFrameworkMacros.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class RPCFrameworkMacros(ctx: blackbox.Context) extends AbstractMacroCommons(ctx
1717
val AsRawRPCCls = tq"$FrameworkObj.AsRawRPC"
1818
val AsRealRPCObj = q"$FrameworkObj.AsRealRPC"
1919
val AsRealRPCCls = tq"$FrameworkObj.AsRealRPC"
20-
val AllRPCTypeClassesObj = q"$RpcPackage.AllRPCTypeClasses"
2120
val RawValueCls = tq"$FrameworkObj.RawValue"
2221
val ArgListsCls = tq"$ListCls[$ListCls[$RawValueCls]]"
2322
val RealInvocationHandlerCls = tq"$FrameworkObj.RealInvocationHandler"
@@ -218,13 +217,6 @@ class RPCFrameworkMacros(ctx: blackbox.Context) extends AbstractMacroCommons(ctx
218217
"""
219218
}
220219

221-
def allRpcTypeClassesImpl[F: c.WeakTypeTag, T: c.WeakTypeTag]: Tree = {
222-
val ftpe = weakTypeOf[F]
223-
val frameworkObj = singleValueFor(ftpe).getOrElse(abort(s"Could not find singleton value for $ftpe"))
224-
val tpe = weakTypeOf[T]
225-
q"$AllRPCTypeClassesObj[$ftpe,$tpe]($frameworkObj.materializeAsReal[$tpe], $frameworkObj.materializeAsRaw[$tpe], $frameworkObj.materializeMetadata[$tpe])"
226-
}
227-
228220
def isRPC[T: c.WeakTypeTag]: Tree = {
229221
checkRpc(weakTypeOf[T])
230222
q"null"

commons-shared/src/test/scala/com/avsystem/commons/rpc/TestRPC.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ case class Record(i: Int, fuu: String)
1515

1616
def indirectRecursion(): TestRPC
1717
}
18-
object InnerRPC extends RPCTypeClasses[DummyRPC.type, InnerRPC]
18+
object InnerRPC extends DummyRPC.RPCCompanion[InnerRPC]
1919

2020
@RPC trait TestRPC {
2121
@silent
@@ -39,7 +39,7 @@ object InnerRPC extends RPCTypeClasses[DummyRPC.type, InnerRPC]
3939
}
4040

4141
@silent
42-
object TestRPC extends RPCTypeClasses[DummyRPC.type, TestRPC] {
42+
object TestRPC extends DummyRPC.RPCCompanion[TestRPC] {
4343
def rpcImpl(onInvocation: (String, List[List[Any]], Option[Any]) => Any) = new TestRPC { outer =>
4444
private def onProcedure(methodName: String, args: List[List[Any]]): Unit =
4545
onInvocation(methodName, args, None)

docs/RPCFramework.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ object SimpleHandler extends RequestHandler {
370370

371371
## Declaring typeclass instances explicitly
372372

373-
For every RPC trait, there are usually three typeclass instances needed: `MyRPCFramework.AsRawRPC`, `MyRPCFramework.AsRealRPC` and (optionally) `RPCMetadata`. Instances for all these typeclasses are automatically materialized by macros. If your trait is designed specifically for particular `RPCFramework` implementation then in order to avoid problems with incremental compilation and possible duplication of code generated by macros, it is recommended that these type class instances be declared explicitly in companion objects of your RPC traits. For example:
373+
For every RPC trait, there are usually three typeclass instances needed: `MyRPCFramework.AsRawRPC`, `MyRPCFramework.AsRealRPC` and (optionally) `MyRPCFramework.RPCMetadata`. Instances for all these typeclasses are automatically materialized by macros. If your trait is designed specifically for particular `RPCFramework` implementation then in order to avoid problems with incremental compilation and possible duplication of code generated by macros, it is recommended that these type class instances be declared explicitly in companion objects of your RPC traits. For example:
374374

375375
```scala
376376
import com.avsystem.commons.rpc._
@@ -381,7 +381,7 @@ import com.avsystem.commons.rpc._
381381
object MyApi {
382382
implicit val asRawRPC: MyRPCFramework.AsRawRPC[MyApi] = MyRPCFramework.materializeAsRaw[MyApi]
383383
implicit val asRealRPC: MyRPCFramework.AsRealRPC[MyApi] = MyRPCFramework.materializeAsReal[MyApi]
384-
implicit val rpcMetadata: RPCMetadata[MyApi] = RPCMetadata.materialize[MyApi]
384+
implicit val rpcMetadata: MyRPCFramework.RPCMetadata[MyApi] = MyRPCFramework.materializeMetadata[MyApi]
385385
}
386386
```
387387

@@ -393,5 +393,5 @@ import com.avsystem.commons.rpc._
393393
@RPC trait MyApi {
394394
...
395395
}
396-
object MyApi extends RPCTypeClasses[MyRPCFramework.type, MyApi]
396+
object MyApi extends MyRPCFramework.RPCCompanion[MyApi]
397397
```

0 commit comments

Comments
 (0)