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
add summary + link to API design doc in the readme (#414)
* add summary + link to API design doc in the readme
* typo
Co-authored-by: Tim Condon <[email protected]>
* typo
Co-authored-by: Tim Condon <[email protected]>
---------
Co-authored-by: Tim Condon <[email protected]>
Copy file name to clipboardExpand all lines: Sources/AWSLambdaRuntime/Docs.docc/index.md
+1-27Lines changed: 1 addition & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Swift AWS Lambda Runtime was designed to make building Lambda functions in Swift
16
16
17
17
## Getting started
18
18
19
-
If you have never used AWS Lambda or Docker before, check out this [getting started guide](https://fabianfett.de/getting-started-with-swift-aws-lambda-runtime) which helps you with every step from zero to a running Lambda.
19
+
If you have never used AWS Lambda or Docker before, check out this [getting started guide](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/1.0.0-alpha.3/tutorials/table-of-content) which helps you with every step from zero to a running Lambda.
20
20
21
21
First, create a SwiftPM project and pull Swift AWS Lambda Runtime as dependency into your project
22
22
@@ -120,32 +120,6 @@ First, add a dependency on the event packages:
120
120
121
121
Modeling Lambda functions as Closures is both simple and safe. Swift AWS Lambda Runtime will ensure that the user-provided code is offloaded from the network processing thread such that even if the code becomes slow to respond or gets stuck, the underlying process can continue to function. This safety comes at a small performance penalty from context switching between threads. In many cases, the simplicity and safety of using the Closure based API is often preferred over the complexity of the performance-oriented API.
122
122
123
-
### Using EventLoopLambdaHandler
124
-
125
-
Performance sensitive Lambda functions may choose to use a more complex API which allows user code to run on the same thread as the networking handlers. Swift AWS Lambda Runtime uses [SwiftNIO](https://github.com/apple/swift-nio) as its underlying networking engine which means the APIs are based on [SwiftNIO](https://github.com/apple/swift-nio) concurrency primitives like the `EventLoop` and `EventLoopFuture`. For example:
126
-
127
-
```swift
128
-
// Import the modules
129
-
importAWSLambdaRuntime
130
-
importAWSLambdaEvents
131
-
importNIO
132
-
133
-
// Our Lambda handler, conforms to EventLoopLambdaHandler
134
-
structHandler: EventLoopLambdaHandler {
135
-
typealiasIn= SNS.Message // Request type
136
-
typealiasOut=Void// Response type
137
-
138
-
// In this example we are receiving an SNS Message, with no response (Void).
Beyond the small cognitive complexity of using the `EventLoopFuture` based APIs, note these APIs should be used with extra care. An [`EventLoopLambdaHandler`][ellh] will execute the user code on the same `EventLoop` (thread) as the library, making processing faster but requiring the user code to never call blocking APIs as it might prevent the underlying process from functioning.
Copy file name to clipboardExpand all lines: readme.md
+28-4Lines changed: 28 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -128,6 +128,10 @@ This should print
128
128
"dlroW olleH"
129
129
```
130
130
131
+
## Tutorial
132
+
133
+
[The Swift AWS Lambda Runtime docc tutorial](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/1.0.0-alpha.3/tutorials/table-of-content) provides developers with detailed step-by-step instructions to develop, build, and deploy a Lambda function.
134
+
131
135
## Swift AWS Lambda Runtime
132
136
133
137
Many modern systems have client components like iOS, macOS or watchOS applications as well as server components that those clients interact with. Serverless functions are often the easiest and most efficient way for client application developers to extend their applications into the cloud.
@@ -142,15 +146,35 @@ Swift AWS Lambda Runtime was designed to make building Lambda functions in Swift
142
146
143
147
## Design Principles
144
148
145
-
tbd + reference to the `v2-api.md` design doc.
149
+
The [design document](Sources/AWSLambdaRuntimeCore/Documentation.docc/Proposals/0001-v2-api.md) details the v2 API proposal for the swift-aws-lambda-runtime library, which aims to enhance the developer experience for building serverless functions in Swift.
146
150
147
-
## Tutorial
151
+
The proposal has been reviewed and [incorporated feedback from the community](https://forums.swift.org/t/aws-lambda-v2-api-proposal/73819). The full v2 API design document is available [in this repository](Sources/AWSLambdaRuntimeCore/Documentation.docc/Proposals/0001-v2-api.md).
152
+
153
+
**Key Design Principles**
154
+
155
+
The v2 API prioritizes the following principles:
156
+
157
+
**Readability and Maintainability**: Extensive use of `async`/`await` improves code clarity and simplifies maintenance.
158
+
159
+
**Developer Control**: Developers own the `main()` function and have the flexibility to inject dependencies into the `LambdaRuntime`. This allows you to manage service lifecycles efficiently using [Swift Service Lifecycle](https://github.com/swift-server/swift-service-lifecycle) for structured concurrency.
148
160
149
-
link to [updated docc tutorial](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/1.0.0-alpha.3/tutorials/table-of-content)
161
+
**Simplified Codable Support**: The `LambdaCodableAdapter` struct eliminates the need for verbose boilerplate code when encoding and decoding events and responses.
162
+
163
+
**New Capabilities**
164
+
165
+
The v2 API introduces two new features:
166
+
167
+
[Response Streaming](https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/]): This functionality is ideal for handling large responses that need to be sent incrementally.
168
+
169
+
[Background Work](https://aws.amazon.com/blogs/compute/running-code-after-returning-a-response-from-an-aws-lambda-function/): Schedule tasks to run after returning a response to the AWS Lambda control plane.
170
+
171
+
These new capabilities provide greater flexibility and control when building serverless functions in Swift with the swift-aws-lambda-runtime library.
0 commit comments