Skip to content

Commit a92a58b

Browse files
authored
Group DocC docs in the index page (#2160)
Motivation: Grouping DocC docs by their area makes it easier to find things. Modifications: - Group docs in the index page - Update various docs Result: Better docs
1 parent 4214504 commit a92a58b

File tree

7 files changed

+110
-4
lines changed

7 files changed

+110
-4
lines changed

Sources/GRPCCore/Configuration/MethodConfig.swift

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
///
1919
/// See also: https://github.com/grpc/grpc-proto/blob/0b30c8c05277ab78ec72e77c9cbf66a26684673d/grpc/service_config/service_config.proto
2020
public struct MethodConfig: Hashable, Sendable {
21+
/// The name of a method to which the method config applies.
2122
public struct Name: Sendable, Hashable {
2223
/// The name of the service, including the namespace.
2324
///
@@ -143,6 +144,7 @@ public struct MethodConfig: Hashable, Sendable {
143144
}
144145
}
145146

147+
/// Whether an RPC should be retried or hedged.
146148
public struct RPCExecutionPolicy: Hashable, Sendable {
147149
@usableFromInline
148150
enum Wrapped: Hashable, Sendable {

Sources/GRPCCore/Configuration/ServiceConfig.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616

1717
/// Service configuration values.
1818
///
19-
/// See also: https://github.com/grpc/grpc-proto/blob/0b30c8c05277ab78ec72e77c9cbf66a26684673d/grpc/service_config/service_config.proto
19+
/// A service config mostly contains parameters describing how clients connecting to a service
20+
/// should behave (for example, the load balancing policy to use).
21+
///
22+
/// The schema is described by [`grpc/service_config/service_config.proto`](https://github.com/grpc/grpc-proto/blob/0b30c8c05277ab78ec72e77c9cbf66a26684673d/grpc/service_config/service_config.proto)
23+
/// in the `grpc/grpc-proto` GitHub repository although gRPC uses it in its JSON form rather than
24+
/// the Protobuf form.
2025
public struct ServiceConfig: Hashable, Sendable {
2126
/// Per-method configuration.
2227
public var methodConfig: [MethodConfig]

Sources/GRPCCore/Documentation.docc/Documentation.md

+81-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ as tutorials.
5252
### Essentials
5353

5454
- <doc:Generating-stubs>
55-
- <doc:Errors>
55+
- <doc:Error-handling>
5656

5757
### Project Information
5858

@@ -64,3 +64,83 @@ Resources for developers working on gRPC Swift:
6464

6565
- <doc:Design>
6666
- <doc:Benchmarks>
67+
68+
### Client and Server
69+
70+
- ``GRPCClient``
71+
- ``GRPCServer``
72+
- ``withGRPCClient(transport:interceptors:isolation:handleClient:)``
73+
- ``withGRPCClient(transport:interceptorPipeline:isolation:handleClient:)``
74+
- ``withGRPCServer(transport:services:interceptors:isolation:handleServer:)``
75+
- ``withGRPCServer(transport:services:interceptorPipeline:isolation:handleServer:)``
76+
77+
### Request and response types
78+
79+
- ``ClientRequest``
80+
- ``StreamingClientRequest``
81+
- ``ClientResponse``
82+
- ``StreamingClientResponse``
83+
- ``ServerRequest``
84+
- ``StreamingServerRequest``
85+
- ``ServerResponse``
86+
- ``StreamingServerResponse``
87+
88+
### Service definition and routing
89+
90+
- ``RegistrableRPCService``
91+
- ``RPCRouter``
92+
93+
### Interceptors
94+
95+
- ``ClientInterceptor``
96+
- ``ServerInterceptor``
97+
- ``ClientContext``
98+
- ``ServerContext``
99+
- ``ClientInterceptorPipelineOperation``
100+
- ``ServerInterceptorPipelineOperation``
101+
102+
### RPC descriptors
103+
104+
- ``MethodDescriptor``
105+
- ``ServiceDescriptor``
106+
107+
### Service config
108+
109+
- ``ServiceConfig``
110+
- ``MethodConfig``
111+
- ``HedgingPolicy``
112+
- ``RetryPolicy``
113+
- ``RPCExecutionPolicy``
114+
115+
### Serialization
116+
117+
- ``MessageSerializer``
118+
- ``MessageDeserializer``
119+
- ``CompressionAlgorithm``
120+
- ``CompressionAlgorithmSet``
121+
122+
### Transport protocols and supporting types
123+
124+
- ``ClientTransport``
125+
- ``ServerTransport``
126+
- ``RPCRequestPart``
127+
- ``RPCResponsePart``
128+
- ``Status``
129+
- ``Metadata``
130+
- ``RetryThrottle``
131+
- ``RPCStream``
132+
- ``RPCWriterProtocol``
133+
- ``ClosableRPCWriterProtocol``
134+
- ``RPCWriter``
135+
- ``RPCAsyncSequence``
136+
137+
### Cancellation
138+
139+
- ``withServerContextRPCCancellationHandle(_:)``
140+
- ``withRPCCancellationHandler(operation:onCancelRPC:)``
141+
142+
### Errors
143+
144+
- ``RPCError``
145+
- ``RPCErrorConvertible``
146+
- ``RuntimeError``

Sources/GRPCCore/Streaming/RPCWriterProtocol.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
/// A sink for values which are produced over time.
17+
/// A type into which values can be written indefinitely.
1818
public protocol RPCWriterProtocol<Element>: Sendable {
1919
/// The type of value written.
2020
associatedtype Element: Sendable
@@ -49,6 +49,7 @@ extension RPCWriterProtocol {
4949
}
5050
}
5151

52+
/// A type into which values can be written until it is finished.
5253
public protocol ClosableRPCWriterProtocol<Element>: RPCWriterProtocol {
5354
/// Indicate to the writer that no more writes are to be accepted.
5455
///

Sources/GRPCCore/Transport/ClientTransport.swift

+11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17+
/// A type that provides a long-lived bidirectional communication channel to a server.
18+
///
19+
/// The client transport is responsible for providing streams to a backend on top of which an
20+
/// RPC can be executed. A typical transport implementation will establish and maintain connections
21+
/// to a server (or servers) and manage these over time, potentially closing idle connections and
22+
/// creating new ones on demand. As such transports can be expensive to create and as such are
23+
/// intended to be used as long-lived objects which exist for the lifetime of your application.
24+
///
25+
/// gRPC provides an in-process transport in the `GRPCInProcessTransport` module and HTTP/2
26+
/// transport built on top of SwiftNIO in the https://github.com/grpc/grpc-swift-nio-transport
27+
/// package.
1728
public protocol ClientTransport: Sendable {
1829
typealias Inbound = RPCAsyncSequence<RPCResponsePart, any Error>
1930
typealias Outbound = RPCWriter<RPCRequestPart>.Closable

Sources/GRPCCore/Transport/ServerTransport.swift

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
/// A protocol server transport implementations must conform to.
17+
/// A type that provides a bidirectional communication channel with a client.
18+
///
19+
/// The server transport is responsible for handling connections created by a client and
20+
/// the multiplexing of those connections into streams corresponding to RPCs.
21+
///
22+
/// gRPC provides an in-process transport in the `GRPCInProcessTransport` module and HTTP/2
23+
/// transport built on top of SwiftNIO in the https://github.com/grpc/grpc-swift-nio-transport
24+
/// package.
1825
public protocol ServerTransport: Sendable {
1926
typealias Inbound = RPCAsyncSequence<RPCRequestPart, any Error>
2027
typealias Outbound = RPCWriter<RPCResponsePart>.Closable

0 commit comments

Comments
 (0)