-
-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from xuwei-k/update-grpc
update grpc 0.13.1
- Loading branch information
Showing
4 changed files
with
7 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
scalapb-runtime-grpc/src/main/scala/com/trueaccord/scalapb/grpc/Marshaller.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
package com.trueaccord.scalapb.grpc | ||
|
||
import java.io.InputStream | ||
import java.io.{ByteArrayInputStream, InputStream} | ||
|
||
import com.trueaccord.scalapb.grpc.ProtoInputStream.NotStarted | ||
import com.trueaccord.scalapb.{GeneratedMessage, GeneratedMessageCompanion, Message} | ||
|
||
class Marshaller[T <: GeneratedMessage with Message[T]](companion: GeneratedMessageCompanion[T]) extends io.grpc.MethodDescriptor.Marshaller[T] { | ||
override def stream(t: T): InputStream = ProtoInputStream.newInstance(t) | ||
override def stream(t: T): InputStream = new ByteArrayInputStream(t.toByteArray) | ||
|
||
override def parse(inputStream: InputStream): T = inputStream match { | ||
/* Optimization for in-memory transport. */ | ||
case ProtoInputStream(NotStarted(m: T @unchecked)) if m.companion == companion => | ||
m | ||
case is => companion.parseFrom(is) | ||
} | ||
override def parse(inputStream: InputStream): T = | ||
companion.parseFrom(inputStream) | ||
} | ||
|
83 changes: 0 additions & 83 deletions
83
scalapb-runtime-grpc/src/main/scala/com/trueaccord/scalapb/grpc/ProtoInputStream.scala
This file was deleted.
Oops, something went wrong.