diff --git a/.spi.yml b/.spi.yml index 6db16665f..b6434a60a 100644 --- a/.spi.yml +++ b/.spi.yml @@ -1,5 +1,9 @@ version: 1 builder: configs: - - documentation_targets: [GRPC, GRPCReflectionService, protoc-gen-grpc-swift, GRPCCore] + - documentation_targets: [GRPCCore, GRPCCodeGen] swift_version: 6.0 + - documentation_targets: [GRPCInProcessTransport] + swift_version: 6.0 + # Don't include @_exported types from GRPCCore + custom_documentation_parameters: [--exclude-extended-types] diff --git a/README.md b/README.md index df7eced27..0d1d9b5fa 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,47 @@ # gRPC Swift -This repository contains a gRPC code generator and runtime libraries for Swift. -You can read more about gRPC on the [gRPC project's website][grpcio]. - -## Versions - -gRPC Swift is currently undergoing active development to take full advantage of -Swift's native concurrency features. The culmination of this work will be a new -major version, v2.x. Pre-release versions will be available in the near future. - -In the meantime, v1.x is available and still supported. You can read more about -it on the [Swift Package Index][spi-grpc-swift-main]. - -## Security - -Please see [SECURITY.md](SECURITY.md). - -## License - -gRPC Swift is released under the same license as [gRPC][gh-grpc], repeated in -[LICENSE](LICENSE). - -## Contributing - -Please get involved! See our [guidelines for contributing](CONTRIBUTING.md). +This repository contains a gRPC implementation for Swift. You can read more +about gRPC on the [gRPC project's website][grpcio]. + +> gRPC Swift v2.x is under active development on the `main` branch and takes +> full advantage of Swift's native concurrency features. +> +> v1.x is still supported and maintained on the `release/1.x` branch. + +- 📚 **Documentation** and **tutorials** are available on the [Swift Package Index][spi-grpc-swift] +- 💻 **Examples** are available in the [Examples](Examples) directory +- 🚀 **Contributions** are welcome, please see [CONTRIBUTING.md](CONTRIBUTING.md) +- 🪪 **License** is Apache 2.0, repeated in [LICENSE](License) +- 🔒 **Security** issues should be reported via the process in [SECURITY.md](SECURITY.md) + +## Quick Start + +The following snippet contains a Swift Package manifest to use gRPC Swift v2.x with +the SwiftNIO based transport and SwiftProtobuf serialization: + +```swift +// swift-tools-version: 6.0 +import PackageDescription + +let package = Package( + name: "foo-package", + platforms: [.macOS("15.0")], + dependencies: [ + .package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "1.0.0-alpha.1"), + .package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0-alpha.1"), + ], + targets: [ + .executableTarget( + name: "bar-target", + dependencies: [ + .product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"), + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), + ] + ) + ] +) +``` [gh-grpc]: https://github.com/grpc/grpc [grpcio]: https://grpc.io -[spi-grpc-swift-main]: https://swiftpackageindex.com/grpc/grpc-swift/main/documentation/grpccore +[spi-grpc-swift]: https://swiftpackageindex.com/grpc/grpc-swift/documentation diff --git a/Sources/GRPCCore/Call/Server/ServerInterceptor.swift b/Sources/GRPCCore/Call/Server/ServerInterceptor.swift index 2243fe8f2..c10c166ca 100644 --- a/Sources/GRPCCore/Call/Server/ServerInterceptor.swift +++ b/Sources/GRPCCore/Call/Server/ServerInterceptor.swift @@ -23,11 +23,9 @@ /// /// Interceptors are registered with the server apply to all RPCs. If you need to modify the /// behavior of an interceptor on a per-RPC basis then you can use the -/// ``ServerInterceptorContext/descriptor`` to determine which RPC is being called and +/// ``ServerContext/descriptor`` to determine which RPC is being called and /// conditionalise behavior accordingly. /// -/// - TODO: Update example and documentation to show how to register an interceptor. -/// /// ## RPC filtering /// /// A common use of server-side interceptors is to filter requests from clients. Interceptors can diff --git a/Sources/GRPCCore/Documentation.docc/Articles/Generating-stubs.md b/Sources/GRPCCore/Documentation.docc/Articles/Generating-stubs.md index 34b57f8d2..c55691a36 100644 --- a/Sources/GRPCCore/Documentation.docc/Articles/Generating-stubs.md +++ b/Sources/GRPCCore/Documentation.docc/Articles/Generating-stubs.md @@ -2,129 +2,14 @@ Learn how to generate stubs for gRPC Swift from a service defined using the Protocol Buffers IDL. -## Overview - -There are two approaches to generating stubs from Protocol Buffers: - -1. With the Swift Package Manager build plugin, or -2. With the Protocol Buffers compiler (`protoc`). - -The following sections describe how and when to use each. - -### Using the Swift Package Manager build plugin - -You can generate stubs at build time by using `GRPCSwiftPlugin` which is a build plugin for the -Swift Package Manager. Using it means that you don't have to manage the generation of -stubs with separate tooling, or check the generated stubs into your source repository. - -The build plugin will generate gRPC stubs for you by building `protoc-gen-grpc-swift` (more details -in the following section) for you and invoking `protoc`. Because of the implicit -dependency on `protoc` being made available by the system `GRPCSwiftPlugin` isn't suitable for use -in: - -- Library packages, or -- Environments where `protoc` isn't available. - -> `GRPCSwiftPlugin` _only_ generates gRPC stubs, it doesn't generate messages. You must generate -> messages in addition to the gRPC Stubs. The [Swift Protobuf](https://github.com/apple/swift-protobuf) -> project provides an equivalent build plugin, `SwiftProtobufPlugin`, for this. - -#### Configuring the build plugin - -You can configure which stubs `GRPCSwiftPlugin` generates and how via a configuration file. This -must be called `grpc-swift-config.json` and can be placed anywhere in the source directory for your -target. - -A config file for the plugin is made up of a number of `protoc` invocations. Each invocation -describes the inputs to `protoc` as well as any options. - -The following is a list of options which can be applied to each invocation object: -- `protoFiles`, an array of strings where each string is the path to an input `.proto` file - _relative to `grpc-swift-config.json`_. -- `visibility`, a string describing the access level of the generated stub (must be one - of `"public"`, `"internal"`, or `"package"`). If not specified then stubs are generated as - `internal`. -- `server`, a boolean indicating whether server stubs should be generated. Defaults to `true` if - not specified. -- `client`, a boolean indicating whether client stubs should be generated. Defaults to `true` if - not specified. -- `_V2`, a boolean indicated whether the generated stubs should be for v2.x. Defaults to `false` if - not specified. - -> The `GRPCSwiftPlugin` build plugin is currently shared between gRPC Swift v1.x and v2.x. To -> generate stubs for v2.x you _must_ set `_V2` to `true` in your config. -> -> This option will be deprecated and removed once v2.x has been released. - -#### Finding protoc - -The build plugin requires a copy of the `protoc` binary to be available. To resolve which copy of -the binary to use, `GRPCSwiftPlugin` will look at the following in order: - -1. The exact path specified in the `protocPath` property in `grpc-swift-config.json`, if present. -2. The exact path specified in the `PROTOC_PATH` environment variable, if set. -3. The first `protoc` binary found in your `PATH` environment variable. - -#### Using the build plugin from Xcode - -Xcode doesn't have access to your `PATH` so in order to use `GRPCSwiftPlugin` with Xcode you must -either set `protocPath` in your `grpc-swift-config.json` or explicitly set `PROTOC_PATH` when -opening Xcode. - -You can do this by running: - -```sh -env PROTOC_PATH=/path/to/protoc xed /path/to/your-project -``` - -Note that Xcode must _not_ be open before running this command. - -#### Example configuration - -We recommend putting your config and `.proto` files in a directory called `Protos` within your -target. Here's an example package structure: - -``` -MyPackage -├── Package.swift -└── Sources - └── MyTarget - └── Protos - ├── foo - │   └── bar - │   ├── baz.proto - │   └── buzz.proto - └── grpc-swift-config.json -``` - -If you wanted the generated stubs from `baz.proto` to be `public`, and to only generate a client -for `buzz.proto` then the `grpc-swift-config` could look like this: - -```json -{ - "invocations": [ - { - "_V2": true, - "protoFiles": ["foo/bar/baz.proto"], - "visibility": "public" - }, - { - "_V2": true, - "protoFiles": ["foo/bar/buzz.proto"], - "server": false - } - ] -} -``` - -### Using protoc +## Using protoc If you've used Protocol Buffers before then generating gRPC Swift stubs should be simple. If you're unfamiliar with Protocol Buffers then you should get comfortable with the concepts before continuing; the [Protocol Buffers website](https://protobuf.dev/) is a great place to start. -gRPC Swift provides `protoc-gen-grpc-swift`, a program which is a plugin for the Protocol Buffers -compiler, `protoc`. +The [`grpc-swift-protobuf`](https://github.com/grpc/grpc-swift-protobuf) package provides +`protoc-gen-grpc-swift`, a program which is a plugin for the Protocol Buffers compiler, `protoc`. > `protoc-gen-grpc-swift` only generates gRPC stubs, it doesn't generate messages. You must use > `protoc-gen-swift` to generate messages in addition to gRPC Stubs. @@ -160,22 +45,16 @@ protoc \ --grpc-swift_out=. ``` -#### Generator options +### Generator options | Name | Possible Values | Default | Description | |---------------------------|--------------------------------------------|------------|----------------------------------------------------------| -| `_V2` | `True`, `False` | `False` | Whether stubs are generated for gRPC Swift v2.x | | `Visibility` | `Public`, `Package`, `Internal` | `Internal` | Access level for generated stubs | | `Server` | `True`, `False` | `True` | Generate server stubs | | `Client` | `True`, `False` | `True` | Generate client stubs | | `FileNaming` | `FullPath`, `PathToUnderscore`, `DropPath` | `FullPath` | How generated source files should be named. (See below.) | | `ProtoPathModuleMappings` | | | Path to module map `.asciipb` file. (See below.) | -| `AccessLevelOnImports` | `True`, `False` | `True` | Whether imports should have explicit access levels. | - -> The `protoc-gen-grpc-swift` binary is currently shared between gRPC Swift v1.x and v2.x. To -> generate stubs for v2.x you _must_ specify `_V2=True`. -> -> This option will be deprecated and removed once v2.x has been released. +| `UseAccessLevelOnImports` | `True`, `False` | `False` | Whether imports should have explicit access levels. | The `FileNaming` option has three possible values, for an input of `foo/bar/baz.proto` the following output file will be generated: @@ -188,12 +67,12 @@ allows you to specify a mapping from `.proto` files to the Swift module they are allows the code generator to add appropriate imports to your generated stubs. This is described in more detail in the [SwiftProtobuf documentation](https://github.com/apple/swift-protobuf/blob/main/Documentation/PLUGIN.md). -#### Building the plugin +### Building the plugin > The version of `protoc-gen-grpc-swift` you use mustn't be newer than the version of -> the `grpc-swift` you're using. +> the `grpc-swift-protobuf` you're using. -If your package depends on `grpc-swift` then you can get a copy of `protoc-gen-grpc-swift` +If your package depends on `grpc-swift-protobuf` then you can get a copy of `protoc-gen-grpc-swift` by building it directly: ```console diff --git a/Sources/GRPCCore/Documentation.docc/Documentation.md b/Sources/GRPCCore/Documentation.docc/Documentation.md index de33f0bb1..4ccc4b5f2 100644 --- a/Sources/GRPCCore/Documentation.docc/Documentation.md +++ b/Sources/GRPCCore/Documentation.docc/Documentation.md @@ -7,17 +7,38 @@ A gRPC library for Swift written natively in Swift. ## Package structure -gRPC Swift is made up of a number of modules, each of which is documented separately. However this -module – ``GRPCCore`` – includes higher level documentation such as tutorials. The following list -contains products of this package: - -- ``GRPCCore`` contains core types and abstractions and is the 'base' module for the project. -- `GRPCInProcessTransport` contains an implementation of an in-process transport. -- `GRPCHTTP2TransportNIOPosix` provides client and server implementations of HTTP/2 transports built - on top of SwiftNIO's POSIX Sockets abstractions. -- `GRPCHTTP2TransportNIOTransportServices` provides client and server implementations of HTTP/2 - transports built on top of SwiftNIO's Network.framework abstraction, `NIOTransportServices`. -- `GRPCProtobuf` provides serialization and deserialization components for `SwiftProtobuf`. +gRPC Swift is distributed across multiple Swift packages. These are: + +- `grpc-swift` (this package) containing core gRPC abstractions and an in-process transport. + - GitHub repository: [`grpc/grpc-swift`](https://github.com/grpc/grpc-swift) + - Documentation: hosted on the [Swift Package + Index](https://swiftpackageindex.com/grpc/grpc-swift/documentation) +- `grpc-swift-nio-transport` contains high-performance HTTP/2 transports built on top + of [SwiftNIO](https://github.com/apple/swift-nio). + - GitHub repository: [`grpc/grpc-swift-nio-transport`](https://github.com/grpc/grpc-swift-nio-transport) + - Documentation: hosted on the [Swift Package + Index](https://swiftpackageindex.com/grpc/grpc-swift-nio-transport/documentation) +- `grpc-swift-protobuf` contains runtime serialization components to interoperate with + [SwiftProtobuf](https://github.com/apple/swift-protobuf) as well as a plugin for the Protocol + Buffers compiler, `protoc`. + - GitHub repository: [`grpc/grpc-swift-protobuf`](https://github.com/grpc/grpc-swift-protobuf) + - Documentation: hosted on the [Swift Package + Index](https://swiftpackageindex.com/grpc/grpc-swift-protobuf/documentation) +- `grpc-swift-extras` contains optional runtime components and integrations with other packages. + - GitHub repository: [`grpc/grpc-swift-extras`](https://github.com/grpc/grpc-swift-extras) + - Documentation: hosted on the [Swift Package + Index](https://swiftpackageindex.com/grpc/grpc-swift-extras/documentation) + +This package, and this module (``GRPCCore``) in particular, include higher level documentation such +as tutorials. + +## Modules in this package + +- ``GRPCCore`` (this module) contains core abstractions, currency types and runtime components + for gRPC Swift. +- `GRPCInProcessTransport` contains an in-process implementation of the ``ClientTransport`` and + ``ServerTransport`` protocols. +- `GRPCodeGen` contains components for building a code generator. ## Topics diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial b/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial index 32ecd4847..e3e4241a4 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Hello-World.tutorial @@ -21,8 +21,8 @@ git clone https://github.com/grpc/grpc-swift ``` - The rest of the tutorial assumes that your current working directory is the cloned `grpc-swift` - directory. + You then need to change directory to the `Examples/hello-world` directory of the cloned + repository. The rest of the tutorial assumes this is the current working directory. } @Section(title: "Run a gRPC application") { @@ -60,8 +60,7 @@ @Steps { @Step { - Open `HelloWorld.proto` in the `Examples/v2/hello-world` directory to see how the - service is defined. + Open `HelloWorld.proto` in to see how the service is defined. @Code(name: "HelloWorld.proto", file: "hello-world-sec03-step01.proto") } @@ -77,10 +76,10 @@ @Section(title: "Update and run the application") { You need to regenerate the stubs as the service definition has changed. To do this run the - following command from the root of the checked out repository: + following command from the _root of the checked out repository_: ```console - Protos/generate.sh + dev/protos/generate.sh ``` To learn how to generate stubs check out the article. @@ -90,7 +89,7 @@ @Steps { @Step { - Open `Serve.swift` in the `Examples/v2/hello-world/Subcommands` directory. + Open `Serve.swift` in the `Subcommands` directory. @Code(name: "Serve.swift", file: "hello-world-sec04-step01.swift") } @@ -102,8 +101,7 @@ } @Step { - Let's update the client now. Open `Greet.swift` in the - `Examples/v2/hello-world/Subcommands` directory. + Let's update the client now. Open `Greet.swift` in the `Subcommands` directory. @Code(name: "Greet.swift", file: "hello-world-sec04-step03.swift") } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step01.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step01.swift index 2c89bab8d..ef1120c64 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step01.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step01.swift @@ -1,6 +1,7 @@ struct Greeter: Helloworld_GreeterServiceProtocol { func sayHello( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { var reply = Helloworld_HelloReply() let recipient = request.message.name.isEmpty ? "stranger" : request.message.name diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step02.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step02.swift index e9dde27f9..44e571bec 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step02.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Hello-World/Resources/hello-world-sec04-step02.swift @@ -1,6 +1,7 @@ struct Greeter: Helloworld_GreeterServiceProtocol { func sayHello( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { var reply = Helloworld_HelloReply() let recipient = request.message.name.isEmpty ? "stranger" : request.message.name @@ -9,7 +10,8 @@ struct Greeter: Helloworld_GreeterServiceProtocol { } func sayHelloAgain( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { var reply = Helloworld_HelloReply() let recipient = request.message.name.isEmpty ? "stranger" : request.message.name diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step07-description.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step07-description.swift index baaffab21..f475a700c 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step07-description.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step07-description.swift @@ -5,8 +5,8 @@ let package = Package( name: "RouteGuide", platforms: [.macOS(.v15)], dependencies: [ - .package(url: "https://github.com/grpc/grpc-swift", branch: "main"), - .package(url: "https://github.com/apple/swift-protobuf", from: "1.27.0"), + .package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0-alpha.1"), + .package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0-alpha.1"), ], targets: [] ) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step08-description.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step08-description.swift index c9f71095f..09de19627 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step08-description.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec01-step08-description.swift @@ -5,16 +5,15 @@ let package = Package( name: "RouteGuide", platforms: [.macOS(.v15)], dependencies: [ - .package(url: "https://github.com/grpc/grpc-swift", branch: "main"), - .package(url: "https://github.com/apple/swift-protobuf", from: "1.27.0"), + .package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0-alpha.1"), + .package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0-alpha.1"), ], targets: [ .executableTarget( name: "RouteGuide", dependencies: [ - .product(name: "_GRPCHTTP2Transport", package: "grpc-swift"), - .product(name: "_GRPCProtobuf", package: "grpc-swift"), - .product(name: "SwiftProtobuf", package: "swift-protobuf"), + .product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"), + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), ] ) ] diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec03-step04-gen-grpc.txt b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec03-step04-gen-grpc.txt index ab2c22fd8..89d320b69 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec03-step04-gen-grpc.txt +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec03-step04-gen-grpc.txt @@ -1,5 +1,4 @@ $ protoc --plugin=.build/debug/protoc-gen-grpc-swift \ -I Protos \ --grpc-swift_out=Sources/Generated \ - --grpc-swift_opt=_V2=true \ Protos/route_guide.proto diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step02-unimplemented.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step02-unimplemented.swift index de6f415cd..b2651be95 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step02-unimplemented.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step02-unimplemented.swift @@ -2,22 +2,26 @@ import GRPCCore struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step03-features.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step03-features.swift index 99bb69ad7..46925a6bb 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step03-features.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step03-features.swift @@ -11,22 +11,26 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift index cf791d6f8..11fbc8215 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift @@ -18,7 +18,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { let feature = self.findFeature( latitude: request.message.latitude, @@ -27,17 +28,20 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift index 452c74a85..d2d82d553 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift @@ -18,7 +18,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { let feature = self.findFeature( latitude: request.message.latitude, @@ -41,17 +42,20 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift index b52288fa3..b833d72f8 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift @@ -18,7 +18,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { let feature = self.findFeature( latitude: request.message.latitude, @@ -41,7 +42,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { return ServerResponse.Stream { writer in for feature in self.features { @@ -53,12 +55,14 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step07-server-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step07-server-streaming.swift index 780c63a14..6c64829e5 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step07-server-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step07-server-streaming.swift @@ -18,7 +18,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { let feature = self.findFeature( latitude: request.message.latitude, @@ -41,7 +42,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { return ServerResponse.Stream { writer in for feature in self.features { @@ -55,12 +57,14 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift index 76f399c50..d9221cd01 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift @@ -19,7 +19,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { let feature = self.findFeature( latitude: request.message.latitude, @@ -42,7 +43,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { return ServerResponse.Stream { writer in for feature in self.features { @@ -56,7 +58,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { let startTime = ContinuousClock.now var pointsVisited = 0 @@ -90,7 +93,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift index 5c8ad560d..c8f9010b5 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift @@ -50,7 +50,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { let feature = self.findFeature( latitude: request.message.latitude, @@ -73,7 +74,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { return ServerResponse.Stream { writer in for feature in self.features { @@ -87,7 +89,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { let startTime = ContinuousClock.now var pointsVisited = 0 @@ -121,7 +124,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift index 3913b0c36..8f4027b5e 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift @@ -50,7 +50,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func getFeature( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Single { let feature = self.findFeature( latitude: request.message.latitude, @@ -73,7 +74,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func listFeatures( - request: ServerRequest.Single + request: ServerRequest.Single, + context: ServerContext ) async throws -> ServerResponse.Stream { return ServerResponse.Stream { writer in for feature in self.features { @@ -87,7 +89,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func recordRoute( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Single { let startTime = ContinuousClock.now var pointsVisited = 0 @@ -121,7 +124,8 @@ struct RouteGuideService: Routeguide_RouteGuide.ServiceProtocol { } func routeChat( - request: ServerRequest.Stream + request: ServerRequest.Stream, + context: ServerContext ) async throws -> ServerResponse.Stream { return ServerResponse.Stream { writer in for try await note in request.messages { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step00-package.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step00-package.swift index c9f71095f..09de19627 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step00-package.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step00-package.swift @@ -5,16 +5,15 @@ let package = Package( name: "RouteGuide", platforms: [.macOS(.v15)], dependencies: [ - .package(url: "https://github.com/grpc/grpc-swift", branch: "main"), - .package(url: "https://github.com/apple/swift-protobuf", from: "1.27.0"), + .package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0-alpha.1"), + .package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0-alpha.1"), ], targets: [ .executableTarget( name: "RouteGuide", dependencies: [ - .product(name: "_GRPCHTTP2Transport", package: "grpc-swift"), - .product(name: "_GRPCProtobuf", package: "grpc-swift"), - .product(name: "SwiftProtobuf", package: "swift-protobuf"), + .product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"), + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), ] ) ] diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step01-package.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step01-package.swift index 05447cfb9..aac2037d5 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step01-package.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step01-package.swift @@ -5,16 +5,15 @@ let package = Package( name: "RouteGuide", platforms: [.macOS(.v15)], dependencies: [ - .package(url: "https://github.com/grpc/grpc-swift", branch: "main"), - .package(url: "https://github.com/apple/swift-protobuf", from: "1.27.0"), + .package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0-alpha.1"), + .package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0-alpha.1"), ], targets: [ .executableTarget( name: "RouteGuide", dependencies: [ - .product(name: "_GRPCHTTP2Transport", package: "grpc-swift"), - .product(name: "_GRPCProtobuf", package: "grpc-swift"), - .product(name: "SwiftProtobuf", package: "swift-protobuf"), + .product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"), + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), ], resources: [ .copy("route_guide_db.json") diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step02-package.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step02-package.swift index 1a49f098d..13c5b9816 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step02-package.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step02-package.swift @@ -5,17 +5,16 @@ let package = Package( name: "RouteGuide", platforms: [.macOS(.v15)], dependencies: [ - .package(url: "https://github.com/grpc/grpc-swift", branch: "main"), - .package(url: "https://github.com/apple/swift-protobuf", from: "1.27.0"), + .package(url: "https://github.com/grpc/grpc-swift.git", from: "2.0.0-alpha.1"), + .package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "1.0.0-alpha.1"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"), ], targets: [ .executableTarget( name: "RouteGuide", dependencies: [ - .product(name: "_GRPCHTTP2Transport", package: "grpc-swift"), - .product(name: "_GRPCProtobuf", package: "grpc-swift"), - .product(name: "SwiftProtobuf", package: "swift-protobuf"), + .product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"), + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), .product(name: "ArgumentParser", package: "swift-argument-parser"), ], resources: [ diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step07-server.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step07-server.swift index b3ffcaf33..a9797e762 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step07-server.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step07-server.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runServer() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step08-run.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step08-run.swift index b99885335..ac8280a58 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step08-run.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step08-run.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runServer() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step02-add-run-client.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step02-add-run-client.swift index eee2b6838..55d8b69ee 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step02-add-run-client.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step02-add-run-client.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step03-create-client.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step03-create-client.swift index ac97861b9..a5f51df0a 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step03-create-client.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step03-create-client.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step04-run-client.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step04-run-client.swift index 76332bada..990676047 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step04-run-client.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step04-run-client.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step05-stub.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step05-stub.swift index e231432bc..693b6993c 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step05-stub.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step05-stub.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift index 5d4e5e725..deb719eda 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift index d22daa343..b36d22e88 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift index 6b5ecaba7..8068f6c31 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift index a0fa49c55..401bf06ec 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift @@ -1,4 +1,4 @@ -import GRPCHTTP2Transport +import GRPCNIOTransportHTTP2 extension RouteGuide { func runClient() async throws { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial index 52b404049..0380b6540 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial @@ -65,7 +65,7 @@ @Step { We need to add a dependency on the gRPC Swift and Swift Protobuf packages. As gRPC Swift v2 - hasn't yet been released the dependency must be on the `main` branch. + hasn't yet been released the dependencies must use the `-alpha` tags. Note that we also add `.macOS(.v15)` to platforms, this is the earliest macOS version supported by gRPC Swift v2. @@ -77,13 +77,10 @@ Next we can add a target. In this tutorial we'll create a single executable target which can act as both a client and a server. - We require two gRPC dependencies: `_GRPCHTTP2Transport"` provides an implementation of an HTTP/2 - client and server, while `_GRPCProtobuf` provides the necessary components to serialize + We require two gRPC dependencies: `GRPCNIOTransportHTTP2"` provides an implementation of an HTTP/2 + client and server, while `GRPCProtobuf` provides the necessary components to serialize and deserialize `SwiftProtobuf` messages. - > Because gRPC Swift v2 hasn't been released yet the product names are prefixed - > with an `"_"`; this indicates that they aren't yet considered as stable public API. - @Code(name: "Package.swift", file: "route-guide-sec01-step08-description.swift") } } @@ -320,7 +317,7 @@ @Steps { @Step { First we need to download a database of known features for the service. Copy - `route_guide_db.json` from the [gRPC Swift repository](https://github.com/grpc/grpc-swift/tree/main/Examples/v2/route-guide) + `route_guide_db.json` from the [gRPC Swift repository](https://github.com/grpc/grpc-swift/tree/main/Examples/route-guide) and place it in the `Sources` directory. } @@ -331,7 +328,7 @@ } @Step { - Now add a `resouces` argument to copy the `route_guide_db.json` database. + Now add a `resources` argument to copy the `route_guide_db.json` database. @Code(name: "Package.swift", file: "route-guide-sec05-step01-package.swift") } @@ -379,7 +376,7 @@ The server is instantiated with a transport which provides the communication with a remote peer. - We'll use an HTTP/2 transport provided by the `GRPCHTTP2Transport` module which is + We'll use an HTTP/2 transport provided by the `GRPCNIOTransportHTTP2` module which is implemented on top of SwiftNIO's Posix sockets abstraction. The server is configured to bind to "127.0.0.1:31415" and use the default configuration. The `.plaintext` transport security means that the connections won't use TLS and will be unencrypted. diff --git a/Sources/GRPCInProcessTransport/Documentation.docc/Documentation.md b/Sources/GRPCInProcessTransport/Documentation.docc/Documentation.md new file mode 100644 index 000000000..c57b262b9 --- /dev/null +++ b/Sources/GRPCInProcessTransport/Documentation.docc/Documentation.md @@ -0,0 +1,17 @@ +# ``GRPCInProcessTransport`` + +This module contains an in-process transport. + +## Overview + +The in-process transport allows you to run a gRPC client and server within the same process +without using a networking stack. This is great for testing but is also suitable for production +use cases. + +## Topics + +### Transports + +- ``InProcessTransport`` +- ``InProcessClientTransport`` +- ``InProcessServerTransport`` diff --git a/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift b/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift index 0637255af..5079fad5c 100644 --- a/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift +++ b/Sources/GRPCInProcessTransport/InProcessTransport+Server.swift @@ -23,7 +23,7 @@ extension InProcessTransport { /// This is useful when you're interested in testing your application without any actual networking layers /// involved, as the client and server will communicate directly with each other via in-process streams. /// - /// To use this server, you call ``listen(_:)`` and iterate over the returned `AsyncSequence` to get all + /// To use this server, you call ``listen(streamHandler:)`` and iterate over the returned `AsyncSequence` to get all /// RPC requests made from clients (as ``RPCStream``s). /// To stop listening to new requests, call ``beginGracefulShutdown()``. ///