Browse Source

Replace "{send,receive}Internal" with "_{send,receive}".

Daniel Alm 7 years ago
parent
commit
9760b25fad

+ 16 - 16
Sources/Examples/Echo/Generated/echo.grpc.swift

@@ -33,14 +33,14 @@ fileprivate final class Echo_EchoGetCallBase: ClientCallUnaryBase<Echo_EchoReque
 
 internal protocol Echo_EchoExpandCall: ClientCallServerStreaming {
   /// Do not call this directly, call `receive()` in the protocol extension below instead.
-  func receiveInternal(timeout: DispatchTime) throws -> Echo_EchoResponse?
+  func _receive(timeout: DispatchTime) throws -> Echo_EchoResponse?
   /// Call this to wait for a result. Nonblocking.
   func receive(completion: @escaping (ResultOrRPCError<Echo_EchoResponse?>) -> Void) throws
 }
 
 internal extension Echo_EchoExpandCall {
   /// Call this to wait for a result. Blocking.
-  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoResponse? { return try self.receiveInternal(timeout: timeout) }
+  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoResponse? { return try self._receive(timeout: timeout) }
 }
 
 fileprivate final class Echo_EchoExpandCallBase: ClientCallServerStreamingBase<Echo_EchoRequest, Echo_EchoResponse>, Echo_EchoExpandCall {
@@ -55,7 +55,7 @@ internal protocol Echo_EchoCollectCall: ClientCallClientStreaming {
   /// Send a message to the stream. Nonblocking.
   func send(_ message: Echo_EchoRequest, completion: @escaping (Error?) -> Void) throws
   /// Do not call this directly, call `send()` in the protocol extension below instead.
-  func sendInternal(_ message: Echo_EchoRequest, timeout: DispatchTime) throws
+  func _send(_ message: Echo_EchoRequest, timeout: DispatchTime) throws
 
   /// Call this to close the connection and wait for a response. Blocking.
   func closeAndReceive() throws -> Echo_EchoResponse
@@ -65,7 +65,7 @@ internal protocol Echo_EchoCollectCall: ClientCallClientStreaming {
 
 internal extension Echo_EchoCollectCall {
   /// Send a message to the stream and wait for the send operation to finish. Blocking.
-  func send(_ message: Echo_EchoRequest, timeout: DispatchTime = .distantFuture) throws { try self.sendInternal(message, timeout: timeout) }
+  func send(_ message: Echo_EchoRequest, timeout: DispatchTime = .distantFuture) throws { try self._send(message, timeout: timeout) }
 }
 
 fileprivate final class Echo_EchoCollectCallBase: ClientCallClientStreamingBase<Echo_EchoRequest, Echo_EchoResponse>, Echo_EchoCollectCall {
@@ -80,14 +80,14 @@ class Echo_EchoCollectCallTestStub: ClientCallClientStreamingTestStub<Echo_EchoR
 
 internal protocol Echo_EchoUpdateCall: ClientCallBidirectionalStreaming {
   /// Do not call this directly, call `receive()` in the protocol extension below instead.
-  func receiveInternal(timeout: DispatchTime) throws -> Echo_EchoResponse?
+  func _receive(timeout: DispatchTime) throws -> Echo_EchoResponse?
   /// Call this to wait for a result. Nonblocking.
   func receive(completion: @escaping (ResultOrRPCError<Echo_EchoResponse?>) -> Void) throws
 
   /// Send a message to the stream. Nonblocking.
   func send(_ message: Echo_EchoRequest, completion: @escaping (Error?) -> Void) throws
   /// Do not call this directly, call `send()` in the protocol extension below instead.
-  func sendInternal(_ message: Echo_EchoRequest, timeout: DispatchTime) throws
+  func _send(_ message: Echo_EchoRequest, timeout: DispatchTime) throws
 
   /// Call this to close the sending connection. Blocking.
   func closeSend() throws
@@ -97,12 +97,12 @@ internal protocol Echo_EchoUpdateCall: ClientCallBidirectionalStreaming {
 
 internal extension Echo_EchoUpdateCall {
   /// Call this to wait for a result. Blocking.
-  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoResponse? { return try self.receiveInternal(timeout: timeout) }
+  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoResponse? { return try self._receive(timeout: timeout) }
 }
 
 internal extension Echo_EchoUpdateCall {
   /// Send a message to the stream and wait for the send operation to finish. Blocking.
-  func send(_ message: Echo_EchoRequest, timeout: DispatchTime = .distantFuture) throws { try self.sendInternal(message, timeout: timeout) }
+  func send(_ message: Echo_EchoRequest, timeout: DispatchTime = .distantFuture) throws { try self._send(message, timeout: timeout) }
 }
 
 fileprivate final class Echo_EchoUpdateCallBase: ClientCallBidirectionalStreamingBase<Echo_EchoRequest, Echo_EchoResponse>, Echo_EchoUpdateCall {
@@ -228,7 +228,7 @@ internal protocol Echo_EchoExpandSession: ServerSessionServerStreaming {
   /// Send a message to the stream. Nonblocking.
   func send(_ message: Echo_EchoResponse, completion: @escaping (Error?) -> Void) throws
   /// Do not call this directly, call `send()` in the protocol extension below instead.
-  func sendInternal(_ message: Echo_EchoResponse, timeout: DispatchTime) throws
+  func _send(_ message: Echo_EchoResponse, timeout: DispatchTime) throws
 
   /// Close the connection and send the status. Non-blocking.
   /// You MUST call this method once you are done processing the request.
@@ -237,7 +237,7 @@ internal protocol Echo_EchoExpandSession: ServerSessionServerStreaming {
 
 internal extension Echo_EchoExpandSession {
   /// Send a message to the stream and wait for the send operation to finish. Blocking.
-  func send(_ message: Echo_EchoResponse, timeout: DispatchTime = .distantFuture) throws { try self.sendInternal(message, timeout: timeout) }
+  func send(_ message: Echo_EchoResponse, timeout: DispatchTime = .distantFuture) throws { try self._send(message, timeout: timeout) }
 }
 
 fileprivate final class Echo_EchoExpandSessionBase: ServerSessionServerStreamingBase<Echo_EchoRequest, Echo_EchoResponse>, Echo_EchoExpandSession {}
@@ -246,7 +246,7 @@ class Echo_EchoExpandSessionTestStub: ServerSessionServerStreamingTestStub<Echo_
 
 internal protocol Echo_EchoCollectSession: ServerSessionClientStreaming {
   /// Do not call this directly, call `receive()` in the protocol extension below instead.
-  func receiveInternal(timeout: DispatchTime) throws -> Echo_EchoRequest?
+  func _receive(timeout: DispatchTime) throws -> Echo_EchoRequest?
   /// Call this to wait for a result. Nonblocking.
   func receive(completion: @escaping (ResultOrRPCError<Echo_EchoRequest?>) -> Void) throws
 
@@ -261,7 +261,7 @@ internal protocol Echo_EchoCollectSession: ServerSessionClientStreaming {
 
 internal extension Echo_EchoCollectSession {
   /// Call this to wait for a result. Blocking.
-  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoRequest? { return try self.receiveInternal(timeout: timeout) }
+  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoRequest? { return try self._receive(timeout: timeout) }
 }
 
 fileprivate final class Echo_EchoCollectSessionBase: ServerSessionClientStreamingBase<Echo_EchoRequest, Echo_EchoResponse>, Echo_EchoCollectSession {}
@@ -270,14 +270,14 @@ class Echo_EchoCollectSessionTestStub: ServerSessionClientStreamingTestStub<Echo
 
 internal protocol Echo_EchoUpdateSession: ServerSessionBidirectionalStreaming {
   /// Do not call this directly, call `receive()` in the protocol extension below instead.
-  func receiveInternal(timeout: DispatchTime) throws -> Echo_EchoRequest?
+  func _receive(timeout: DispatchTime) throws -> Echo_EchoRequest?
   /// Call this to wait for a result. Nonblocking.
   func receive(completion: @escaping (ResultOrRPCError<Echo_EchoRequest?>) -> Void) throws
 
   /// Send a message to the stream. Nonblocking.
   func send(_ message: Echo_EchoResponse, completion: @escaping (Error?) -> Void) throws
   /// Do not call this directly, call `send()` in the protocol extension below instead.
-  func sendInternal(_ message: Echo_EchoResponse, timeout: DispatchTime) throws
+  func _send(_ message: Echo_EchoResponse, timeout: DispatchTime) throws
 
   /// Close the connection and send the status. Non-blocking.
   /// You MUST call this method once you are done processing the request.
@@ -286,12 +286,12 @@ internal protocol Echo_EchoUpdateSession: ServerSessionBidirectionalStreaming {
 
 internal extension Echo_EchoUpdateSession {
   /// Call this to wait for a result. Blocking.
-  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoRequest? { return try self.receiveInternal(timeout: timeout) }
+  func receive(timeout: DispatchTime = .distantFuture) throws -> Echo_EchoRequest? { return try self._receive(timeout: timeout) }
 }
 
 internal extension Echo_EchoUpdateSession {
   /// Send a message to the stream and wait for the send operation to finish. Blocking.
-  func send(_ message: Echo_EchoResponse, timeout: DispatchTime = .distantFuture) throws { try self.sendInternal(message, timeout: timeout) }
+  func send(_ message: Echo_EchoResponse, timeout: DispatchTime = .distantFuture) throws { try self._send(message, timeout: timeout) }
 }
 
 fileprivate final class Echo_EchoUpdateSessionBase: ServerSessionBidirectionalStreamingBase<Echo_EchoRequest, Echo_EchoResponse>, Echo_EchoUpdateSession {}

+ 3 - 3
Sources/SwiftGRPC/Runtime/ClientCallBidirectionalStreaming.swift

@@ -59,20 +59,20 @@ open class ClientCallBidirectionalStreamingTestStub<InputType: Message, OutputTy
   
   public init() {}
 
-  open func receiveInternal(timeout: DispatchTime) throws -> OutputType? {
+  open func _receive(timeout: DispatchTime) throws -> OutputType? {
     defer { if !outputs.isEmpty { outputs.removeFirst() } }
     return outputs.first
   }
   
   open func receive(completion: @escaping (ResultOrRPCError<OutputType?>) -> Void) throws {
-    completion(.result(try self.receiveInternal(timeout: .distantFuture)))
+    completion(.result(try self._receive(timeout: .distantFuture)))
   }
 
   open func send(_ message: InputType, completion _: @escaping (Error?) -> Void) throws {
     inputs.append(message)
   }
   
-  open func sendInternal(_ message: InputType, timeout: DispatchTime) throws {
+  open func _send(_ message: InputType, timeout: DispatchTime) throws {
     inputs.append(message)
   }
 

+ 1 - 1
Sources/SwiftGRPC/Runtime/ClientCallClientStreaming.swift

@@ -76,7 +76,7 @@ open class ClientCallClientStreamingTestStub<InputType: Message, OutputType: Mes
     inputs.append(message)
   }
   
-  open func sendInternal(_ message: InputType, timeout: DispatchTime) throws {
+  open func _send(_ message: InputType, timeout: DispatchTime) throws {
     inputs.append(message)
   }
 

+ 2 - 2
Sources/SwiftGRPC/Runtime/ClientCallServerStreaming.swift

@@ -45,13 +45,13 @@ open class ClientCallServerStreamingTestStub<OutputType: Message>: ClientCallSer
   
   public init() {}
   
-  open func receiveInternal(timeout: DispatchTime) throws -> OutputType? {
+  open func _receive(timeout: DispatchTime) throws -> OutputType? {
     defer { if !outputs.isEmpty { outputs.removeFirst() } }
     return outputs.first
   }
   
   open func receive(completion: @escaping (ResultOrRPCError<OutputType?>) -> Void) throws {
-    completion(.result(try self.receiveInternal(timeout: .distantFuture)))
+    completion(.result(try self._receive(timeout: .distantFuture)))
   }
 
   open func cancel() {}

+ 3 - 3
Sources/SwiftGRPC/Runtime/ServerSessionBidirectionalStreaming.swift

@@ -69,20 +69,20 @@ open class ServerSessionBidirectionalStreamingTestStub<InputType: Message, Outpu
   open var outputs: [OutputType] = []
   open var status: ServerStatus?
 
-  open func receiveInternal(timeout: DispatchTime) throws -> InputType? {
+  open func _receive(timeout: DispatchTime) throws -> InputType? {
     defer { if !inputs.isEmpty { inputs.removeFirst() } }
     return inputs.first
   }
   
   open func receive(completion: @escaping (ResultOrRPCError<InputType?>) -> Void) throws {
-    completion(.result(try self.receiveInternal(timeout: .distantFuture)))
+    completion(.result(try self._receive(timeout: .distantFuture)))
   }
 
   open func send(_ message: OutputType, completion _: @escaping (Error?) -> Void) throws {
     outputs.append(message)
   }
 
-  open func sendInternal(_ message: OutputType, timeout: DispatchTime) throws {
+  open func _send(_ message: OutputType, timeout: DispatchTime) throws {
     outputs.append(message)
   }
 

+ 2 - 2
Sources/SwiftGRPC/Runtime/ServerSessionClientStreaming.swift

@@ -75,13 +75,13 @@ open class ServerSessionClientStreamingTestStub<InputType: Message, OutputType:
   open var output: OutputType?
   open var status: ServerStatus?
 
-  open func receiveInternal(timeout: DispatchTime) throws -> InputType? {
+  open func _receive(timeout: DispatchTime) throws -> InputType? {
     defer { if !inputs.isEmpty { inputs.removeFirst() } }
     return inputs.first
   }
   
   open func receive(completion: @escaping (ResultOrRPCError<InputType?>) -> Void) throws {
-    completion(.result(try self.receiveInternal(timeout: .distantFuture)))
+    completion(.result(try self._receive(timeout: .distantFuture)))
   }
 
   open func sendAndClose(response: OutputType, status: ServerStatus, completion: (() -> Void)?) throws {

+ 1 - 1
Sources/SwiftGRPC/Runtime/ServerSessionServerStreaming.swift

@@ -72,7 +72,7 @@ open class ServerSessionServerStreamingTestStub<OutputType: Message>: ServerSess
     outputs.append(message)
   }
 
-  open func sendInternal(_ message: OutputType, timeout: DispatchTime) throws {
+  open func _send(_ message: OutputType, timeout: DispatchTime) throws {
     outputs.append(message)
   }
 

+ 1 - 1
Sources/SwiftGRPC/Runtime/StreamReceiving.swift

@@ -43,7 +43,7 @@ extension StreamReceiving {
     }
   }
   
-  public func receiveInternal(timeout: DispatchTime) throws -> ReceivedType? {
+  public func _receive(timeout: DispatchTime) throws -> ReceivedType? {
     var result: ResultOrRPCError<ReceivedType?>?
     let sem = DispatchSemaphore(value: 0)
     try receive {

+ 1 - 1
Sources/SwiftGRPC/Runtime/StreamSending.swift

@@ -29,7 +29,7 @@ extension StreamSending {
     try call.sendMessage(data: message.serializedData(), completion: completion)
   }
   
-  public func sendInternal(_ message: SentType, timeout: DispatchTime) throws {
+  public func _send(_ message: SentType, timeout: DispatchTime) throws {
     var resultError: Error?
     let sem = DispatchSemaphore(value: 0)
     try send(message) {

+ 4 - 4
Sources/protoc-gen-swiftgrpc/Generator-Methods.swift

@@ -20,7 +20,7 @@ import SwiftProtobufPluginLibrary
 extension Generator {
   func printStreamReceiveMethods(receivedType: String) {
     println("/// Do not call this directly, call `receive()` in the protocol extension below instead.")
-    println("func receiveInternal(timeout: DispatchTime) throws -> \(receivedType)?")
+    println("func _receive(timeout: DispatchTime) throws -> \(receivedType)?")
     println("/// Call this to wait for a result. Nonblocking.")
     println("func receive(completion: @escaping (ResultOrRPCError<\(receivedType)?>) -> Void) throws")
   }
@@ -29,7 +29,7 @@ extension Generator {
     println("\(access) extension \(extendedType) {")
     indent()
     println("/// Call this to wait for a result. Blocking.")
-    println("func receive(timeout: DispatchTime = .distantFuture) throws -> \(receivedType)? { return try self.receiveInternal(timeout: timeout) }")
+    println("func receive(timeout: DispatchTime = .distantFuture) throws -> \(receivedType)? { return try self._receive(timeout: timeout) }")
     outdent()
     println("}")
   }
@@ -38,14 +38,14 @@ extension Generator {
     println("/// Send a message to the stream. Nonblocking.")
     println("func send(_ message: \(sentType), completion: @escaping (Error?) -> Void) throws")
     println("/// Do not call this directly, call `send()` in the protocol extension below instead.")
-    println("func sendInternal(_ message: \(sentType), timeout: DispatchTime) throws")
+    println("func _send(_ message: \(sentType), timeout: DispatchTime) throws")
   }
   
   func printStreamSendExtension(extendedType: String,sentType: String) {
     println("\(access) extension \(extendedType) {")
     indent()
     println("/// Send a message to the stream and wait for the send operation to finish. Blocking.")
-    println("func send(_ message: \(sentType), timeout: DispatchTime = .distantFuture) throws { try self.sendInternal(message, timeout: timeout) }")
+    println("func send(_ message: \(sentType), timeout: DispatchTime = .distantFuture) throws { try self._send(message, timeout: timeout) }")
     outdent()
     println("}")
   }