Skip to content

Commit b01eff8

Browse files
committed
Revision: Remove ~Copyable from StreamingLambdaHandler + Update EventLoop paragraph
1 parent bffb114 commit b01eff8

File tree

1 file changed

+10
-11
lines changed
  • Sources/AWSLambdaRuntimeCore/Documentation.docc/Proposals

1 file changed

+10
-11
lines changed

Sources/AWSLambdaRuntimeCore/Documentation.docc/Proposals/0001-v2-api.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ Versions:
2828
#### EventLoop interfaces
2929

3030
The current API extensively uses the `EventLoop` family of interfaces from SwiftNIO in many areas. To use these
31-
interfaces correctly though, it requires developers to exercise great care and be aware of certain details such as never
32-
running blocking code on the same `EventLoop` the library uses. Developers also need to understand the various transform
33-
methods that are used to work with `EventLoop`s and `EventLoopFuture`s. This results in a lot of cognitive complexity
34-
and makes the code in the current API hard to reason about and maintain. For these reasons, the overarching trend in the
35-
Swift on Server ecosystem is to shift to newer, more readable, Swift concurrency constructs and de-couple from
36-
SwiftNIO's `EventLoop` interfaces.
31+
interfaces correctly though, it requires developers to exercise great care and understand the various transform methods
32+
that are used to work with `EventLoop`s and `EventLoopFuture`s. This results in a lot of cognitive complexity and makes
33+
the code in the current API hard to reason about and maintain. For these reasons, the overarching trend in the Swift on
34+
Server ecosystem is to shift to newer, more readable, Swift concurrency constructs and de-couple from SwiftNIO's
35+
`EventLoop` interfaces.
3736

3837
#### No ownership of the main() function
3938

@@ -262,15 +261,15 @@ this protocol and instead use the `LambdaHandler` protocol defined below.
262261

263262
```swift
264263
/// The base StreamingLambdaHandler protocol
265-
public protocol StreamingLambdaHandler: ~Copyable {
264+
public protocol StreamingLambdaHandler {
266265
/// The business logic of the Lambda function
267266
/// - Parameters:
268267
/// - event: The invocation's input data
269268
/// - responseWriter: A ``LambdaResponseStreamWriter`` to write the invocation's response to.
270269
/// If no response or error is written to the `responseWriter` it will
271270
/// report an error to the invoker.
272271
/// - context: The LambdaContext containing the invocation's metadata
273-
/// - Throws
272+
/// - Throws:
274273
/// How the thrown error will be handled by the runtime:
275274
/// - An invocation error will be reported if the error is thrown before the first call to
276275
/// ``LambdaResponseStreamWriter.write(_:)``.
@@ -296,7 +295,7 @@ plane, since the `handle(...)` function is free to implement any background work
296295
`responseWriter.finish()`.
297296

298297
The protocol is defined in a way that supports a broad range of use-cases. The handle method is marked as `mutating` to
299-
allow handlers to be implemented with a `struct`. Users can opt to even mark the handler as non-copyable.
298+
allow handlers to be implemented with a `struct`.
300299

301300
An implementation that sends the number 1 to 10 every 500ms could look like this:
302301

@@ -451,7 +450,7 @@ provide support for `swift-service-lifecycle`.
451450
/// The LambdaRuntime object. This object communicates with the Lambda control plane
452451
/// to fetch work and report errors.
453452
public final class LambdaRuntime<Handler>: ServiceLifecycle.Service, Sendable
454-
where Handler: StreamingLambdaHandler, Handler: ~Copyable
453+
where Handler: StreamingLambdaHandler
455454
{
456455

457456
/// Create a LambdaRuntime by passing a handler, an eventLoop and a logger.
@@ -792,7 +791,7 @@ The `StreamingLambdaHandler` would look like this:
792791

793792
```swift
794793
/// The base LambdaHandler protocol
795-
public protocol StreamingLambdaHandler: ~Copyable {
794+
public protocol StreamingLambdaHandler {
796795
/// The business logic of the Lambda function
797796
/// - Parameters:
798797
/// - event: The invocation's input data

0 commit comments

Comments
 (0)