Skip to content

Commit 2733478

Browse files
authored
Merge pull request #56 from grpc/internal_access
Change access level for generated classes and methods to "internal"
2 parents a8a2c18 + f3926c5 commit 2733478

18 files changed

+124
-150
lines changed

Examples/Datastore/PackageManager/RUNME

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ protoc \
1616
googleapis/google/type/latlng.proto \
1717
-Igoogleapis \
1818
--swift_out=googleapis \
19-
--swift_opt=Visibility=Public \
20-
--plugin=$HOME/local/bin/protoc-gen-swift \
2119
--swiftgrpc_out=Sources
2220

2321
# move swift files to this directory

Examples/Echo/Generated/echo.client.pb.swift

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ import Dispatch
4444
import gRPC
4545

4646
/// Type for errors thrown from generated client code.
47-
public enum Echo_EchoClientError : Error {
47+
internal enum Echo_EchoClientError : Error {
4848
case endOfStream
4949
case invalidMessageReceived
5050
case error(c: CallResult)
5151
}
5252

5353
/// Get (Unary)
54-
public class Echo_EchoGetCall {
54+
internal class Echo_EchoGetCall {
5555
private var call : Call
5656

5757
/// Create a call.
@@ -101,7 +101,7 @@ public class Echo_EchoGetCall {
101101
}
102102

103103
/// Expand (Server Streaming)
104-
public class Echo_EchoExpandCall {
104+
internal class Echo_EchoExpandCall {
105105
private var call : Call
106106

107107
/// Create a call.
@@ -123,7 +123,7 @@ public class Echo_EchoExpandCall {
123123
}
124124

125125
/// Call this to wait for a result. Blocking.
126-
public func receive() throws -> Echo_EchoResponse {
126+
internal func receive() throws -> Echo_EchoResponse {
127127
var returnError : Echo_EchoClientError?
128128
var returnResponse : Echo_EchoResponse!
129129
let sem = DispatchSemaphore(value: 0)
@@ -142,7 +142,7 @@ public class Echo_EchoExpandCall {
142142
}
143143

144144
/// Call this to wait for a result. Nonblocking.
145-
public func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
145+
internal func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
146146
do {
147147
try call.receiveMessage() {(responseData) in
148148
if let responseData = responseData {
@@ -160,7 +160,7 @@ public class Echo_EchoExpandCall {
160160
}
161161

162162
/// Collect (Client Streaming)
163-
public class Echo_EchoCollectCall {
163+
internal class Echo_EchoCollectCall {
164164
private var call : Call
165165

166166
/// Create a call.
@@ -176,13 +176,13 @@ public class Echo_EchoCollectCall {
176176
}
177177

178178
/// Call this to send each message in the request stream. Nonblocking.
179-
public func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
179+
internal func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
180180
let messageData = try message.serializedData()
181181
try call.sendMessage(data:messageData, errorHandler:errorHandler)
182182
}
183183

184184
/// Call this to close the connection and wait for a response. Blocking.
185-
public func closeAndReceive() throws -> Echo_EchoResponse {
185+
internal func closeAndReceive() throws -> Echo_EchoResponse {
186186
var returnError : Echo_EchoClientError?
187187
var returnResponse : Echo_EchoResponse!
188188
let sem = DispatchSemaphore(value: 0)
@@ -203,7 +203,7 @@ public class Echo_EchoCollectCall {
203203
}
204204

205205
/// Call this to close the connection and wait for a response. Nonblocking.
206-
public func closeAndReceive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->())
206+
internal func closeAndReceive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->())
207207
throws {
208208
do {
209209
try call.receiveMessage() {(responseData) in
@@ -222,7 +222,7 @@ public class Echo_EchoCollectCall {
222222
}
223223

224224
/// Update (Bidirectional Streaming)
225-
public class Echo_EchoUpdateCall {
225+
internal class Echo_EchoUpdateCall {
226226
private var call : Call
227227

228228
/// Create a call.
@@ -238,7 +238,7 @@ public class Echo_EchoUpdateCall {
238238
}
239239

240240
/// Call this to wait for a result. Blocking.
241-
public func receive() throws -> Echo_EchoResponse {
241+
internal func receive() throws -> Echo_EchoResponse {
242242
var returnError : Echo_EchoClientError?
243243
var returnMessage : Echo_EchoResponse!
244244
let sem = DispatchSemaphore(value: 0)
@@ -257,7 +257,7 @@ public class Echo_EchoUpdateCall {
257257
}
258258

259259
/// Call this to wait for a result. Nonblocking.
260-
public func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
260+
internal func receive(completion:@escaping (Echo_EchoResponse?, Echo_EchoClientError?)->()) throws {
261261
do {
262262
try call.receiveMessage() {(data) in
263263
if let data = data {
@@ -274,13 +274,13 @@ public class Echo_EchoUpdateCall {
274274
}
275275

276276
/// Call this to send each message in the request stream.
277-
public func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
277+
internal func send(_ message:Echo_EchoRequest, errorHandler:@escaping (Error)->()) throws {
278278
let messageData = try message.serializedData()
279279
try call.sendMessage(data:messageData, errorHandler:errorHandler)
280280
}
281281

282282
/// Call this to close the sending connection. Blocking.
283-
public func closeSend() throws {
283+
internal func closeSend() throws {
284284
let sem = DispatchSemaphore(value: 0)
285285
try closeSend() {
286286
sem.signal()
@@ -289,24 +289,24 @@ public class Echo_EchoUpdateCall {
289289
}
290290

291291
/// Call this to close the sending connection. Nonblocking.
292-
public func closeSend(completion:@escaping ()->()) throws {
292+
internal func closeSend(completion:@escaping ()->()) throws {
293293
try call.close() {
294294
completion()
295295
}
296296
}
297297
}
298298

299299
/// Call methods of this class to make API calls.
300-
public class Echo_EchoService {
300+
internal class Echo_EchoService {
301301
private var channel: Channel
302302

303303
/// This metadata will be sent with all requests.
304-
public var metadata : Metadata
304+
internal var metadata : Metadata
305305

306306
/// This property allows the service host name to be overridden.
307307
/// For example, it can be used to make calls to "localhost:8080"
308308
/// appear to be to "example.com".
309-
public var host : String {
309+
internal var host : String {
310310
get {
311311
return self.channel.host
312312
}
@@ -316,27 +316,27 @@ public class Echo_EchoService {
316316
}
317317

318318
/// Create a client that makes insecure connections.
319-
public init(address: String) {
319+
internal init(address: String) {
320320
gRPC.initialize()
321321
channel = Channel(address:address)
322322
metadata = Metadata()
323323
}
324324

325325
/// Create a client that makes secure connections.
326-
public init(address: String, certificates: String?, host: String?) {
326+
internal init(address: String, certificates: String?, host: String?) {
327327
gRPC.initialize()
328328
channel = Channel(address:address, certificates:certificates, host:host)
329329
metadata = Metadata()
330330
}
331331

332332
/// Synchronous. Unary.
333-
public func get(_ request: Echo_EchoRequest)
333+
internal func get(_ request: Echo_EchoRequest)
334334
throws
335335
-> Echo_EchoResponse {
336336
return try Echo_EchoGetCall(channel).run(request:request, metadata:metadata)
337337
}
338338
/// Asynchronous. Unary.
339-
public func get(_ request: Echo_EchoRequest,
339+
internal func get(_ request: Echo_EchoRequest,
340340
completion: @escaping (Echo_EchoResponse?, CallResult)->())
341341
throws
342342
-> Echo_EchoGetCall {
@@ -347,23 +347,23 @@ public class Echo_EchoService {
347347
/// Asynchronous. Server-streaming.
348348
/// Send the initial message.
349349
/// Use methods on the returned object to get streamed responses.
350-
public func expand(_ request: Echo_EchoRequest, completion: @escaping (CallResult)->())
350+
internal func expand(_ request: Echo_EchoRequest, completion: @escaping (CallResult)->())
351351
throws
352352
-> Echo_EchoExpandCall {
353353
return try Echo_EchoExpandCall(channel).start(request:request, metadata:metadata, completion:completion)
354354
}
355355
/// Asynchronous. Client-streaming.
356356
/// Use methods on the returned object to stream messages and
357357
/// to close the connection and wait for a final response.
358-
public func collect(completion: @escaping (CallResult)->())
358+
internal func collect(completion: @escaping (CallResult)->())
359359
throws
360360
-> Echo_EchoCollectCall {
361361
return try Echo_EchoCollectCall(channel).start(metadata:metadata, completion:completion)
362362
}
363363
/// Asynchronous. Bidirectional-streaming.
364364
/// Use methods on the returned object to stream messages,
365365
/// to wait for replies, and to close the connection.
366-
public func update(completion: @escaping (CallResult)->())
366+
internal func update(completion: @escaping (CallResult)->())
367367
throws
368368
-> Echo_EchoUpdateCall {
369369
return try Echo_EchoUpdateCall(channel).start(metadata:metadata, completion:completion)

Examples/Echo/Generated/echo.pb.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
3333
typealias Version = _1
3434
}
3535

36-
public struct Echo_EchoRequest: SwiftProtobuf.Message {
37-
public static let protoMessageName: String = _protobuf_package + ".EchoRequest"
36+
struct Echo_EchoRequest: SwiftProtobuf.Message {
37+
static let protoMessageName: String = _protobuf_package + ".EchoRequest"
3838

3939
/// The text of a message to be echoed.
40-
public var text: String = String()
40+
var text: String = String()
4141

42-
public var unknownFields = SwiftProtobuf.UnknownStorage()
42+
var unknownFields = SwiftProtobuf.UnknownStorage()
4343

44-
public init() {}
44+
init() {}
4545

46-
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
46+
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
4747
while let fieldNumber = try decoder.nextFieldNumber() {
4848
switch fieldNumber {
4949
case 1: try decoder.decodeSingularStringField(value: &self.text)
@@ -52,25 +52,25 @@ public struct Echo_EchoRequest: SwiftProtobuf.Message {
5252
}
5353
}
5454

55-
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
55+
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
5656
if !self.text.isEmpty {
5757
try visitor.visitSingularStringField(value: self.text, fieldNumber: 1)
5858
}
5959
try unknownFields.traverse(visitor: &visitor)
6060
}
6161
}
6262

63-
public struct Echo_EchoResponse: SwiftProtobuf.Message {
64-
public static let protoMessageName: String = _protobuf_package + ".EchoResponse"
63+
struct Echo_EchoResponse: SwiftProtobuf.Message {
64+
static let protoMessageName: String = _protobuf_package + ".EchoResponse"
6565

6666
/// The text of an echo response.
67-
public var text: String = String()
67+
var text: String = String()
6868

69-
public var unknownFields = SwiftProtobuf.UnknownStorage()
69+
var unknownFields = SwiftProtobuf.UnknownStorage()
7070

71-
public init() {}
71+
init() {}
7272

73-
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
73+
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
7474
while let fieldNumber = try decoder.nextFieldNumber() {
7575
switch fieldNumber {
7676
case 1: try decoder.decodeSingularStringField(value: &self.text)
@@ -79,7 +79,7 @@ public struct Echo_EchoResponse: SwiftProtobuf.Message {
7979
}
8080
}
8181

82-
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
82+
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
8383
if !self.text.isEmpty {
8484
try visitor.visitSingularStringField(value: self.text, fieldNumber: 1)
8585
}
@@ -92,23 +92,23 @@ public struct Echo_EchoResponse: SwiftProtobuf.Message {
9292
fileprivate let _protobuf_package = "echo"
9393

9494
extension Echo_EchoRequest: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
95-
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
95+
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
9696
1: .same(proto: "text"),
9797
]
9898

99-
public func _protobuf_generated_isEqualTo(other: Echo_EchoRequest) -> Bool {
99+
func _protobuf_generated_isEqualTo(other: Echo_EchoRequest) -> Bool {
100100
if self.text != other.text {return false}
101101
if unknownFields != other.unknownFields {return false}
102102
return true
103103
}
104104
}
105105

106106
extension Echo_EchoResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
107-
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
107+
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
108108
1: .same(proto: "text"),
109109
]
110110

111-
public func _protobuf_generated_isEqualTo(other: Echo_EchoResponse) -> Bool {
111+
func _protobuf_generated_isEqualTo(other: Echo_EchoResponse) -> Bool {
112112
if self.text != other.text {return false}
113113
if unknownFields != other.unknownFields {return false}
114114
return true

0 commit comments

Comments
 (0)