Skip to content

Commit 3e1d7bb

Browse files
committed
Rename In to Event and Out to Output
1 parent 501bc6e commit 3e1d7bb

File tree

13 files changed

+67
-67
lines changed

13 files changed

+67
-67
lines changed

Examples/LambdaFunctions/Sources/Benchmark/main.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import NIO
2222
Lambda.run { $0.eventLoop.makeSucceededFuture(BenchmarkHandler()) }
2323

2424
struct BenchmarkHandler: EventLoopLambdaHandler {
25-
typealias In = String
26-
typealias Out = String
25+
typealias Event = String
26+
typealias Output = String
2727

2828
func handle(_ event: String, context: Lambda.Context) -> EventLoopFuture<String> {
2929
context.eventLoop.makeSucceededFuture("hello, world!")

Examples/LambdaFunctions/Sources/CurrencyExchange/CurrencyExchangeHandler.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import Logging
2525

2626
@main
2727
struct CurrencyExchangeHandler: LambdaHandler {
28-
typealias In = Request
29-
typealias Out = [Exchange]
28+
typealias Event = Request
29+
typealias Output = [Exchange]
3030

3131
let calculator: ExchangeRatesCalculator
3232

Examples/LambdaFunctions/Sources/ErrorHandling/ErrorsHappenHandler.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import AWSLambdaRuntime
1818

1919
@main
2020
struct ErrorsHappenHandler: LambdaHandler {
21-
typealias In = Request
22-
typealias Out = Response
21+
typealias Event = Request
22+
typealias Output = Response
2323

2424
init(context: Lambda.InitializationContext) async throws {}
2525

Examples/LambdaFunctions/Sources/HelloWorld/HelloWorldHandler.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import AWSLambdaRuntime
1717
// introductory example, the obligatory "hello, world!"
1818
@main
1919
struct HelloWorldHandler: LambdaHandler {
20-
typealias In = String
21-
typealias Out = String
20+
typealias Event = String
21+
typealias Output = String
2222

2323
init(context: Lambda.InitializationContext) async throws {
2424
// setup your resources that you want to reuse here.

Examples/LocalDebugging/MyLambda/Sources/MyLambda/MyLambdaHandler.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import Shared
1919
// a local server simulator which will allow local debugging
2020
@main
2121
struct MyLambdaHandler: LambdaHandler {
22-
typealias In = Request
23-
typealias Out = Response
22+
typealias Event = Request
23+
typealias Output = Response
2424

2525
init(context: Lambda.InitializationContext) async throws {
2626
// setup your resources that you want to reuse for every invocation here.

Sources/AWSLambdaRuntime/Lambda+Codable.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@ import NIOFoundationCompat
2121

2222
// MARK: - Codable support
2323

24-
/// Implementation of a`ByteBuffer` to `In` decoding
25-
extension EventLoopLambdaHandler where In: Decodable {
24+
/// Implementation of a`ByteBuffer` to `Event` decoding
25+
extension EventLoopLambdaHandler where Event: Decodable {
2626
@inlinable
27-
public func decode(buffer: ByteBuffer) throws -> In {
28-
try self.decoder.decode(In.self, from: buffer)
27+
public func decode(buffer: ByteBuffer) throws -> Event {
28+
try self.decoder.decode(Event.self, from: buffer)
2929
}
3030
}
3131

32-
/// Implementation of `Out` to `ByteBuffer` encoding
33-
extension EventLoopLambdaHandler where Out: Encodable {
32+
/// Implementation of `Output` to `ByteBuffer` encoding
33+
extension EventLoopLambdaHandler where Output: Encodable {
3434
@inlinable
35-
public func encode(allocator: ByteBufferAllocator, value: Out) throws -> ByteBuffer? {
35+
public func encode(allocator: ByteBufferAllocator, value: Output) throws -> ByteBuffer? {
3636
try self.encoder.encode(value, using: allocator)
3737
}
3838
}
3939

40-
/// Default `ByteBuffer` to `In` decoder using Foundation's JSONDecoder
40+
/// Default `ByteBuffer` to `Event` decoder using Foundation's JSONDecoder
4141
/// Advanced users that want to inject their own codec can do it by overriding these functions.
42-
extension EventLoopLambdaHandler where In: Decodable {
42+
extension EventLoopLambdaHandler where Event: Decodable {
4343
public var decoder: LambdaCodableDecoder {
4444
Lambda.defaultJSONDecoder
4545
}
4646
}
4747

48-
/// Default `Out` to `ByteBuffer` encoder using Foundation's JSONEncoder
48+
/// Default `Output` to `ByteBuffer` encoder using Foundation's JSONEncoder
4949
/// Advanced users that want to inject their own codec can do it by overriding these functions.
50-
extension EventLoopLambdaHandler where Out: Encodable {
50+
extension EventLoopLambdaHandler where Output: Encodable {
5151
public var encoder: LambdaCodableEncoder {
5252
Lambda.defaultJSONEncoder
5353
}

Sources/AWSLambdaRuntimeCore/Lambda+String.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414
import NIOCore
1515

16-
extension EventLoopLambdaHandler where In == String {
16+
extension EventLoopLambdaHandler where Event == String {
1717
/// Implementation of a `ByteBuffer` to `String` decoding
1818
@inlinable
1919
public func decode(buffer: ByteBuffer) throws -> String {
@@ -25,7 +25,7 @@ extension EventLoopLambdaHandler where In == String {
2525
}
2626
}
2727

28-
extension EventLoopLambdaHandler where Out == String {
28+
extension EventLoopLambdaHandler where Output == String {
2929
/// Implementation of `String` to `ByteBuffer` encoding
3030
@inlinable
3131
public func encode(allocator: ByteBufferAllocator, value: String) throws -> ByteBuffer? {

Sources/AWSLambdaRuntimeCore/LambdaHandler.swift

+22-22
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import NIOCore
1919
// MARK: - LambdaHandler
2020

2121
#if compiler(>=5.5)
22-
/// Strongly typed, processing protocol for a Lambda that takes a user defined `In` and returns a user defined `Out` async.
22+
/// Strongly typed, processing protocol for a Lambda that takes a user defined `Event` and returns a user defined `Output` async.
2323
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
2424
public protocol LambdaHandler: EventLoopLambdaHandler {
2525
/// The Lambda initialization method
@@ -34,17 +34,17 @@ public protocol LambdaHandler: EventLoopLambdaHandler {
3434
/// Concrete Lambda handlers implement this method to provide the Lambda functionality.
3535
///
3636
/// - parameters:
37-
/// - event: Event of type `In` representing the event or request.
37+
/// - event: Event of type `Event` representing the event or request.
3838
/// - context: Runtime `Context`.
3939
///
40-
/// - Returns: A Lambda result ot type `Out`.
41-
func handle(_ event: In, context: Lambda.Context) async throws -> Out
40+
/// - Returns: A Lambda result ot type `Output`.
41+
func handle(_ event: Event, context: Lambda.Context) async throws -> Output
4242
}
4343

4444
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
4545
extension LambdaHandler {
46-
public func handle(_ event: In, context: Lambda.Context) -> EventLoopFuture<Out> {
47-
let promise = context.eventLoop.makePromise(of: Out.self)
46+
public func handle(_ event: Event, context: Lambda.Context) -> EventLoopFuture<Output> {
47+
let promise = context.eventLoop.makePromise(of: Output.self)
4848
promise.completeWithTask {
4949
try await self.handle(event, context: context)
5050
}
@@ -62,52 +62,52 @@ extension LambdaHandler {
6262

6363
// MARK: - EventLoopLambdaHandler
6464

65-
/// Strongly typed, `EventLoopFuture` based processing protocol for a Lambda that takes a user defined `In` and returns a user defined `Out` asynchronously.
66-
/// `EventLoopLambdaHandler` extends `ByteBufferLambdaHandler`, performing `ByteBuffer` -> `In` decoding and `Out` -> `ByteBuffer` encoding.
65+
/// Strongly typed, `EventLoopFuture` based processing protocol for a Lambda that takes a user defined `Event` and returns a user defined `Output` asynchronously.
66+
/// `EventLoopLambdaHandler` extends `ByteBufferLambdaHandler`, performing `ByteBuffer` -> `Event` decoding and `Output` -> `ByteBuffer` encoding.
6767
///
6868
/// - note: To implement a Lambda, implement either `LambdaHandler` or the `EventLoopLambdaHandler` protocol.
6969
/// The `LambdaHandler` will offload the Lambda execution to a `DispatchQueue` making processing safer but slower
7070
/// The `EventLoopLambdaHandler` will execute the Lambda on the same `EventLoop` as the core runtime engine, making the processing faster but requires
7171
/// more care from the implementation to never block the `EventLoop`.
7272
public protocol EventLoopLambdaHandler: ByteBufferLambdaHandler {
73-
associatedtype In
74-
associatedtype Out
73+
associatedtype Event
74+
associatedtype Output
7575

7676
/// The Lambda handling method
7777
/// Concrete Lambda handlers implement this method to provide the Lambda functionality.
7878
///
7979
/// - parameters:
8080
/// - context: Runtime `Context`.
81-
/// - event: Event of type `In` representing the event or request.
81+
/// - event: Event of type `Event` representing the event or request.
8282
///
8383
/// - Returns: An `EventLoopFuture` to report the result of the Lambda back to the runtime engine.
84-
/// The `EventLoopFuture` should be completed with either a response of type `Out` or an `Error`
85-
func handle(_ event: In, context: Lambda.Context) -> EventLoopFuture<Out>
84+
/// The `EventLoopFuture` should be completed with either a response of type `Output` or an `Error`
85+
func handle(_ event: Event, context: Lambda.Context) -> EventLoopFuture<Output>
8686

87-
/// Encode a response of type `Out` to `ByteBuffer`
87+
/// Encode a response of type `Output` to `ByteBuffer`
8888
/// Concrete Lambda handlers implement this method to provide coding functionality.
8989
/// - parameters:
9090
/// - allocator: A `ByteBufferAllocator` to help allocate the `ByteBuffer`.
91-
/// - value: Response of type `Out`.
91+
/// - value: Response of type `Output`.
9292
///
9393
/// - Returns: A `ByteBuffer` with the encoded version of the `value`.
94-
func encode(allocator: ByteBufferAllocator, value: Out) throws -> ByteBuffer?
94+
func encode(allocator: ByteBufferAllocator, value: Output) throws -> ByteBuffer?
9595

96-
/// Decode a`ByteBuffer` to a request or event of type `In`
96+
/// Decode a`ByteBuffer` to a request or event of type `Event`
9797
/// Concrete Lambda handlers implement this method to provide coding functionality.
9898
///
9999
/// - parameters:
100100
/// - buffer: The `ByteBuffer` to decode.
101101
///
102-
/// - Returns: A request or event of type `In`.
103-
func decode(buffer: ByteBuffer) throws -> In
102+
/// - Returns: A request or event of type `Event`.
103+
func decode(buffer: ByteBuffer) throws -> Event
104104
}
105105

106106
extension EventLoopLambdaHandler {
107-
/// Driver for `ByteBuffer` -> `In` decoding and `Out` -> `ByteBuffer` encoding
107+
/// Driver for `ByteBuffer` -> `Event` decoding and `Output` -> `ByteBuffer` encoding
108108
@inlinable
109109
public func handle(_ event: ByteBuffer, context: Lambda.Context) -> EventLoopFuture<ByteBuffer?> {
110-
let input: In
110+
let input: Event
111111
do {
112112
input = try self.decode(buffer: event)
113113
} catch {
@@ -125,7 +125,7 @@ extension EventLoopLambdaHandler {
125125
}
126126

127127
/// Implementation of `ByteBuffer` to `Void` decoding
128-
extension EventLoopLambdaHandler where Out == Void {
128+
extension EventLoopLambdaHandler where Output == Void {
129129
@inlinable
130130
public func encode(allocator: ByteBufferAllocator, value: Void) throws -> ByteBuffer? {
131131
nil

Sources/AWSLambdaTesting/Lambda+Testing.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ extension Lambda {
6666

6767
public static func test<Handler: LambdaHandler>(
6868
_ handlerType: Handler.Type,
69-
with event: Handler.In,
69+
with event: Handler.Event,
7070
using config: TestConfig = .init()
71-
) throws -> Handler.Out {
71+
) throws -> Handler.Output {
7272
let logger = Logger(label: "test")
7373
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
7474
defer {

Sources/CodableSample/main.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ struct Response: Codable {
2626
// in this example we are receiving and responding with codables. Request and Response above are examples of how to use
2727
// codables to model your reqeuest and response objects
2828
struct Handler: EventLoopLambdaHandler {
29-
typealias In = Request
30-
typealias Out = Response
29+
typealias Event = Request
30+
typealias Output = Response
3131

3232
func handle(_ event: Request, context: Lambda.Context) -> EventLoopFuture<Response> {
3333
// as an example, respond with the input event's reversed body

Sources/StringSample/main.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import NIOCore
1717

1818
// in this example we are receiving and responding with strings
1919
struct Handler: EventLoopLambdaHandler {
20-
typealias In = String
21-
typealias Out = String
20+
typealias Event = String
21+
typealias Output = String
2222

2323
func handle(_ event: String, context: Lambda.Context) -> EventLoopFuture<String> {
2424
// as an example, respond with the event's reversed body

Tests/AWSLambdaRuntimeTests/Lambda+CodeableTest.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class CodableLambdaTest: XCTestCase {
3838
var outputBuffer: ByteBuffer?
3939

4040
struct Handler: EventLoopLambdaHandler {
41-
typealias In = Request
42-
typealias Out = Void
41+
typealias Event = Request
42+
typealias Output = Void
4343

4444
let expected: Request
4545

@@ -63,8 +63,8 @@ class CodableLambdaTest: XCTestCase {
6363
var response: Response?
6464

6565
struct Handler: EventLoopLambdaHandler {
66-
typealias In = Request
67-
typealias Out = Response
66+
typealias Event = Request
67+
typealias Output = Response
6868

6969
let expected: Request
7070

@@ -86,8 +86,8 @@ class CodableLambdaTest: XCTestCase {
8686
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
8787
func testCodableVoidHandler() {
8888
struct Handler: LambdaHandler {
89-
typealias In = Request
90-
typealias Out = Void
89+
typealias Event = Request
90+
typealias Output = Void
9191

9292
var expected: Request?
9393

@@ -115,8 +115,8 @@ class CodableLambdaTest: XCTestCase {
115115
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
116116
func testCodableHandler() {
117117
struct Handler: LambdaHandler {
118-
typealias In = Request
119-
typealias Out = Response
118+
typealias Event = Request
119+
typealias Output = Response
120120

121121
var expected: Request?
122122

Tests/AWSLambdaTestingTests/Tests.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class LambdaTestingTests: XCTestCase {
3030
}
3131

3232
struct MyLambda: LambdaHandler {
33-
typealias In = Request
34-
typealias Out = Response
33+
typealias Event = Request
34+
typealias Output = Response
3535

3636
init(context: Lambda.InitializationContext) {}
3737

@@ -54,8 +54,8 @@ class LambdaTestingTests: XCTestCase {
5454
}
5555

5656
struct MyLambda: LambdaHandler {
57-
typealias In = Request
58-
typealias Out = Void
57+
typealias Event = Request
58+
typealias Output = Void
5959

6060
init(context: Lambda.InitializationContext) {}
6161

@@ -74,8 +74,8 @@ class LambdaTestingTests: XCTestCase {
7474
struct MyError: Error {}
7575

7676
struct MyLambda: LambdaHandler {
77-
typealias In = String
78-
typealias Out = Void
77+
typealias Event = String
78+
typealias Output = Void
7979

8080
init(context: Lambda.InitializationContext) {}
8181

@@ -91,8 +91,8 @@ class LambdaTestingTests: XCTestCase {
9191

9292
func testAsyncLongRunning() {
9393
struct MyLambda: LambdaHandler {
94-
typealias In = String
95-
typealias Out = String
94+
typealias Event = String
95+
typealias Output = String
9696

9797
init(context: Lambda.InitializationContext) {}
9898

0 commit comments

Comments
 (0)