Skip to content

Commit b388b22

Browse files
committed
Update Examples sources and README
1 parent eb33409 commit b388b22

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

Examples/CloudFunctions/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Lambda Functions Examples
1+
# Serverless Cloud Functions Examples
22

3-
This sample project is a collection of Lambda functions that demonstrates
4-
how to write a simple Lambda function in Swift, and how to package and deploy it
5-
to the AWS Lambda platform.
3+
This sample project is a collection of cloud functions that demonstrates
4+
how to write a simple SCF function in Swift, and how to package and deploy it
5+
to the Tencent SCF platform.
66

77
The scripts are prepared to work from the `CloudFunctions` folder.
88

99
```
1010
git clone https://github.com/stevapple/swift-tencent-scf-runtime.git
11-
cd tencent-scf-runtime/Examples/LambdaFunctions
11+
cd swift-tencent-scf-runtime/Examples/CloudFunctions
1212
```
1313

1414
Note: The example scripts assume you have [jq](https://stedolan.github.io/jq/download/) command line tool installed.

Examples/CloudFunctions/Sources/APIGateway/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ import NIO
2929
import TencentSCFEvents
3030
import TencentSCFRuntime
3131

32-
// MARK: - Run Lambda
32+
// MARK: - Run SCF function
3333

3434
Lambda.run(APIGatewayProxyLambda())
3535

3636
// MARK: - Handler, Request and Response
3737

38-
// FIXME: Use proper Event abstractions once added to AWSLambdaRuntime
38+
// FIXME: Use proper Event abstractions once added to TencentSCFRuntime
3939
struct APIGatewayProxyLambda: EventLoopLambdaHandler {
4040
public typealias In = APIGateway.Request
4141
public typealias Out = APIGateway.Response

Examples/CloudFunctions/Sources/Benchmark/main.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import NIO
2929
import TencentSCFRuntimeCore
3030

31-
// If you would like to benchmark Swift's Lambda Runtime,
31+
// If you would like to benchmark Swift's SCF Runtime,
3232
// use this example which is more performant.
33-
// `EventLoopLambdaHandler` does not offload the Lambda processing to a separate thread
34-
// while the closure-based handlers do.
33+
// `EventLoopLambdaHandler` does not offload the cloud function processing to a separate thread
34+
// while the Closure-based handlers do.
3535
Lambda.run(BenchmarkHandler())
3636

3737
struct BenchmarkHandler: EventLoopLambdaHandler {

Examples/CloudFunctions/Sources/ErrorHandling/main.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727

2828
import TencentSCFRuntime
2929

30-
// MARK: - Run Lambda
30+
// MARK: - Run SCF function
3131

3232
// switch over the error type "requested" by the request, and trigger such error accordingly
3333
Lambda.run { (context: Lambda.Context, request: Request, callback: (Result<Response, Error>) -> Void) in
3434
switch request.error {
3535
// no error here!
3636
case .none:
37-
callback(.success(Response(awsRequestID: context.requestID, requestID: request.requestID, status: .ok)))
37+
callback(.success(Response(scfRequestID: context.requestID, requestID: request.requestID, status: .ok)))
3838
// trigger a "managed" error - domain specific business logic failure
3939
case .managed:
40-
callback(.success(Response(awsRequestID: context.requestID, requestID: request.requestID, status: .error)))
40+
callback(.success(Response(scfRequestID: context.requestID, requestID: request.requestID, status: .error)))
4141
// trigger an "unmanaged" error - an unexpected Swift Error triggered while processing the request
4242
case .unmanaged(let error):
4343
callback(.failure(UnmanagedError(description: error)))
@@ -93,12 +93,12 @@ struct Request: Codable {
9393
}
9494

9595
struct Response: Codable {
96-
let awsRequestID: String
96+
let scfRequestID: String
9797
let requestID: String
9898
let status: Status
9999

100-
public init(awsRequestID: String, requestID: String, status: Status) {
101-
self.awsRequestID = awsRequestID
100+
public init(scfRequestID: String, requestID: String, status: Status) {
101+
self.scfRequestID = scfRequestID
102102
self.requestID = requestID
103103
self.status = status
104104
}

Examples/LocalDebugging/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Local Debugging Example
22

3-
This sample project demonstrates how to write a simple Lambda function in Swift,
4-
and how to use local debugging techniques that simulate how the Lambda function
5-
would be invoked by the AWS Lambda Runtime engine.
3+
This sample project demonstrates how to write a simple SCF function in Swift,
4+
and how to use local debugging techniques that simulate how the SCF function
5+
would be invoked by the Tencent SCF Runtime engine.
66

77
The example includes an Xcode workspace with three modules:
88

9-
1. [MyApp](MyApp) is a SwiftUI iOS application that calls the Lambda function.
10-
2. [MyCloudFunction](MyCloudFunction) is a SwiftPM executable package for the Lambda function.
9+
1. [MyApp](MyApp) is a SwiftUI iOS application that calls the SCF function.
10+
2. [MyCloudFunction](MyCloudFunction) is a SwiftPM executable package for the SCF function.
1111
3. [Shared](Shared) is a SwiftPM library package used for shared code between the iOS application and the Lambda function,
1212
such as the Request and Response model objects.
1313

14-
The local debugging experience is achieved by running the Lambda function in the context of the
14+
The local debugging experience is achieved by running the SCF function in the context of the
1515
debug-only local lambda engine simulator which starts a local HTTP server enabling the communication
16-
between the iOS application and the Lambda function over HTTP.
16+
between the iOS application and the SCF function over HTTP.
1717

1818
To try out this example, open the workspace in Xcode and "run" the two targets,
1919
using the relevant `MyCloudFunction` and `MyApp` Xcode schemes.
@@ -23,7 +23,7 @@ Start with running the `MyCloudFunction` target.
2323
* Set the `LOCAL_SCF_SERVER_ENABLED` environment variable to `true` by editing the `MyCloudFunction` scheme Run/Arguments options.
2424
* Hit `Run`
2525
* Once it is up you should see a log message in the Xcode console saying
26-
`LocalLambdaServer started and listening on 127.0.0.1:7000, receiving events on /invoke`
26+
`LocalSCFServer started and listening on 127.0.0.1:7000, receiving events on /invoke`
2727
which means the local emulator is up and receiving traffic on port `7000` and expecting events on the `/invoke` endpoint.
2828

2929
Continue to run the `MyApp` target
@@ -32,4 +32,4 @@ Continue to run the `MyApp` target
3232
* Once up, the application's UI should appear in the simulator allowing you
3333
to interact with it.
3434

35-
Once both targets are running, set up breakpoints in the iOS application or Lambda function to observe the system behavior.
35+
Once both targets are running, set up breakpoints in the iOS application or cloud function to observe the system behavior.

0 commit comments

Comments
 (0)