Skip to content

Commit a6e8cbb

Browse files
committed
Rename "services" to "serviceProviders".
1 parent 98f7fa6 commit a6e8cbb

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Examples/EchoXcode/Echo/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2929

3030
// create and start a server for handling insecure requests
3131
insecureServer = ServiceServer(address: "localhost:8081",
32-
services: [echoProvider])
32+
serviceProviders: [echoProvider])
3333
insecureServer.start()
3434

3535
// create and start a server for handling secure requests
@@ -38,7 +38,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3838
secureServer = ServiceServer(address: "localhost:8443",
3939
certificateURL: certificateURL,
4040
keyURL: keyURL,
41-
services: [echoProvider])
41+
serviceProviders: [echoProvider])
4242
secureServer.start()
4343
}
4444
}

Sources/Examples/Echo/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ Group {
6969
echoServer = ServiceServer(address: address + ":" + port,
7070
certificateURL: certificateURL,
7171
keyURL: keyURL,
72-
services: [EchoProvider()])
72+
serviceProviders: [EchoProvider()])
7373
echoServer?.start()
7474
} else {
7575
print("starting insecure server")
76-
echoServer = ServiceServer(address: address + ":" + port, services: [EchoProvider()])
76+
echoServer = ServiceServer(address: address + ":" + port, serviceProviders: [EchoProvider()])
7777
echoServer?.start()
7878
}
7979
// This blocks to keep the main thread from finishing while the server runs,

Sources/SwiftGRPC/Runtime/ServiceServer.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@ open class ServiceServer {
2727
fileprivate let servicesByName: [String: ServiceProvider]
2828

2929
/// Create a server that accepts insecure connections.
30-
public init(address: String, services: [ServiceProvider]) {
30+
public init(address: String, serviceProviders: [ServiceProvider]) {
3131
gRPC.initialize()
3232
self.address = address
3333
server = Server(address: address)
34-
servicesByName = Dictionary(uniqueKeysWithValues: services.map { ($0.serviceName, $0) })
34+
servicesByName = Dictionary(uniqueKeysWithValues: serviceProviders.map { ($0.serviceName, $0) })
3535
}
3636

3737
/// Create a server that accepts secure connections.
38-
public init(address: String, certificateString: String, keyString: String, services: [ServiceProvider]) {
38+
public init(address: String, certificateString: String, keyString: String, serviceProviders: [ServiceProvider]) {
3939
gRPC.initialize()
4040
self.address = address
4141
server = Server(address: address, key: keyString, certs: certificateString)
42-
servicesByName = Dictionary(uniqueKeysWithValues: services.map { ($0.serviceName, $0) })
42+
servicesByName = Dictionary(uniqueKeysWithValues: serviceProviders.map { ($0.serviceName, $0) })
4343
}
4444

4545
/// Create a server that accepts secure connections.
46-
public init?(address: String, certificateURL: URL, keyURL: URL, services: [ServiceProvider]) {
46+
public init?(address: String, certificateURL: URL, keyURL: URL, serviceProviders: [ServiceProvider]) {
4747
guard let certificate = try? String(contentsOf: certificateURL, encoding: .utf8),
4848
let key = try? String(contentsOf: keyURL, encoding: .utf8)
4949
else { return nil }
5050
gRPC.initialize()
5151
self.address = address
5252
server = Server(address: address, key: key, certs: certificate)
53-
servicesByName = Dictionary(uniqueKeysWithValues: services.map { ($0.serviceName, $0) })
53+
servicesByName = Dictionary(uniqueKeysWithValues: serviceProviders.map { ($0.serviceName, $0) })
5454
}
5555

5656
/// Start the server.

Tests/SwiftGRPCTests/BasicEchoTestCase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ class BasicEchoTestCase: XCTestCase {
5151
server = ServiceServer(address: address,
5252
certificateString: certificateString,
5353
keyString: String(data: keyForTests, encoding: .utf8)!,
54-
services: [provider])
54+
serviceProviders: [provider])
5555
server.start()
5656
client = Echo_EchoServiceClient(address: address, certificates: certificateString, arguments: [.sslTargetNameOverride("example.com")])
5757
client.host = "example.com"
5858
} else {
59-
server = ServiceServer(address: address, services: [provider])
59+
server = ServiceServer(address: address, serviceProviders: [provider])
6060
server.start()
6161
client = Echo_EchoServiceClient(address: address, secure: false)
6262
}

0 commit comments

Comments
 (0)