You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Dependencies can now be injected into `LambdaRuntime` — `swift-service-lifecycle` guarantees that the services will be
134
-
initialized _before_ the `LambdaRuntime`’s `run()` function is called.
134
+
initialized _before_ the `LambdaRuntime`'s `run()` function is called.
135
135
- The required services can then be used within the handler in a structured concurrency manner.
136
136
`swift-service-lifecycle` takes care of listening for termination signals and terminating the services as well as the
137
137
`LambdaRuntime` in correct order.
@@ -162,7 +162,7 @@ try await serviceGroup.run()
162
162
163
163
### Simplifying Codable support
164
164
165
-
A detailed explanation is provided in the Codable Support section. In short, much of the boilerplate code defined for
165
+
A detailed explanation is provided in the **Codable Support** section. In short, much of the boilerplate code defined for
166
166
each handler protocol in `Lambda+Codable` and `Lambda+String` will be replaced with a single `LambdaCodableAdapter`
167
167
class.
168
168
@@ -181,7 +181,7 @@ Both will be explained in the **Detailed Solution** section.
181
181
182
182
## Detailed Solution
183
183
184
-
Below you’ll find explanation’s for all types that we want to use in AWS Lambda Runtime v2.
184
+
Below are explanations for all types that we want to use in AWS Lambda Runtime v2.
185
185
186
186
### LambdaResponseWriter
187
187
@@ -205,10 +205,10 @@ public protocol LambdaResponseWriter: ~Copyable {
205
205
### LambdaContext
206
206
207
207
`LambdaContext` will be largely unchanged, but the `eventLoop` property as well as the `allocator` property (of type
208
-
`ByteBuffer`) will be removed.
208
+
`ByteBufferAllocator`) will be removed.
209
209
210
-
A new function `backgroundTask()` will also be added. This will allow tasks to be run in the background while and after
211
-
the response is/has been sent. Please note that `LambdaContext` will not be Sendable anymore.
210
+
A new function `addBackgroundTask(_:)` will also be added. This will allow tasks to be run in the background while and after
211
+
the response is/has been sent. Please note that `LambdaContext` will not be `Sendable` anymore.
212
212
213
213
```swift
214
214
/// A context object passed as part of an invocation in LambdaHandler handle functions.
@@ -247,10 +247,10 @@ public struct LambdaContext {
247
247
### StreamingLambdaHandler
248
248
249
249
The new `StreamingLambdaHandler` protocol is the base protocol to implement a Lambda function. Most users will not use
250
-
this protocol and instead use the `LambdaHandler` protocol defined in the `Codable` Support section.
250
+
this protocol and instead use the `LambdaHandler` protocol defined in the **Codable Support** section.
251
251
252
252
```swift
253
-
/// The base LambdaHandler protocol
253
+
/// The base StreamingLambdaHandler protocol
254
254
publicprotocolStreamingLambdaHandler: ~Copyable {
255
255
/// The business logic of the Lambda function
256
256
/// - Parameters:
@@ -354,7 +354,7 @@ enum Lambda {
354
354
Since the library now provides ownership of the `main()` function and allows users to initialize services before the
355
355
`LambdaRuntime` is initialized, the library cannot implicitly report
356
356
[errors that occur during initialization to the dedicated endpoint AWS exposes](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html#runtimes-api-initerror)
357
-
like it currently does through the `initialize()` function of `LambdaRunner` which wraps the handler’s `init(...)` and
357
+
like it currently does through the `initialize()` function of `LambdaRunner` which wraps the handler's `init(...)` and
358
358
handles any errors thrown by reporting it to the dedicated AWS endpoint.
359
359
360
360
To retain support for initialization error reporting, the `Lambda.reportStartupError(any Error)` function gives users
@@ -431,7 +431,7 @@ public protocol LambdaOutputEncoder {
431
431
}
432
432
```
433
433
434
-
We provide conformances for Foundation’s `JSONDecoder` to `LambdaEventDecoder` and `JSONEncoder` to
434
+
We provide conformances for Foundation's `JSONDecoder` to `LambdaEventDecoder` and `JSONEncoder` to
435
435
`LambdaOutputEncoder`.
436
436
437
437
3. Implements its `handle()` method by:
@@ -446,7 +446,7 @@ We provide conformances for Foundation’s `JSONDecoder` to `LambdaEventDecoder`
446
446
the user.
447
447
448
448
```swift
449
-
/// Wraps an underlying handler conforming to `CodableLambdaHandler`
449
+
/// Wraps an underlying handler conforming to `LambdaHandler`
450
450
/// with encoding/decoding logic
451
451
publicstructLambdaCodableAdapter<
452
452
Handler: LambdaHandler,
@@ -486,16 +486,16 @@ To create a Lambda function using the current API, a user first has to create an
486
486
handler protocols by implementing the initializer and the `handle(...)` function. Now that `LambdaRuntime` is public,
487
487
this verbosity can very easily be simplified.
488
488
489
-
**ClosureHandler**
489
+
#### ClosureHandler
490
490
491
491
This handler is generic over any `Event` type conforming to `Decodable` and any `Output` type conforming to `Encodable`
0 commit comments