@@ -33,10 +33,10 @@ public protocol LambdaHandler: EventLoopLambdaHandler {
33
33
///
34
34
/// - parameters:
35
35
/// - context: Runtime `Context`.
36
- /// - payload: Payload of type `In` representing the event or request.
36
+ /// - event: Event of type `In` representing the event or request.
37
37
/// - callback: Completion handler to report the result of the Lambda back to the runtime engine.
38
38
/// The completion handler expects a `Result` with either a response of type `Out` or an `Error`
39
- func handle( context: Lambda . Context , payload : In , callback: @escaping ( Result < Out , Error > ) -> Void )
39
+ func handle( context: Lambda . Context , event : In , callback: @escaping ( Result < Out , Error > ) -> Void )
40
40
}
41
41
42
42
internal extension Lambda {
@@ -52,11 +52,11 @@ public extension LambdaHandler {
52
52
/// `LambdaHandler` is offloading the processing to a `DispatchQueue`
53
53
/// This is slower but safer, in case the implementation blocks the `EventLoop`
54
54
/// Performance sensitive Lambdas should be based on `EventLoopLambdaHandler` which does not offload.
55
- func handle( context: Lambda . Context , payload : In ) -> EventLoopFuture < Out > {
55
+ func handle( context: Lambda . Context , event : In ) -> EventLoopFuture < Out > {
56
56
let promise = context. eventLoop. makePromise ( of: Out . self)
57
57
// FIXME: reusable DispatchQueue
58
58
self . offloadQueue. async {
59
- self . handle ( context: context, payload : payload , callback: promise. completeWith)
59
+ self . handle ( context: context, event : event , callback: promise. completeWith)
60
60
}
61
61
return promise. futureResult
62
62
}
@@ -80,11 +80,11 @@ public protocol EventLoopLambdaHandler: ByteBufferLambdaHandler {
80
80
///
81
81
/// - parameters:
82
82
/// - context: Runtime `Context`.
83
- /// - payload: Payload of type `In` representing the event or request.
83
+ /// - event: Event of type `In` representing the event or request.
84
84
///
85
85
/// - Returns: An `EventLoopFuture` to report the result of the Lambda back to the runtime engine.
86
86
/// The `EventLoopFuture` should be completed with either a response of type `Out` or an `Error`
87
- func handle( context: Lambda . Context , payload : In ) -> EventLoopFuture < Out >
87
+ func handle( context: Lambda . Context , event : In ) -> EventLoopFuture < Out >
88
88
89
89
/// Encode a response of type `Out` to `ByteBuffer`
90
90
/// Concrete Lambda handlers implement this method to provide coding functionality.
@@ -107,12 +107,12 @@ public protocol EventLoopLambdaHandler: ByteBufferLambdaHandler {
107
107
108
108
public extension EventLoopLambdaHandler {
109
109
/// Driver for `ByteBuffer` -> `In` decoding and `Out` -> `ByteBuffer` encoding
110
- func handle( context: Lambda . Context , payload : ByteBuffer ) -> EventLoopFuture < ByteBuffer ? > {
111
- switch self . decodeIn ( buffer: payload ) {
110
+ func handle( context: Lambda . Context , event : ByteBuffer ) -> EventLoopFuture < ByteBuffer ? > {
111
+ switch self . decodeIn ( buffer: event ) {
112
112
case . failure( let error) :
113
113
return context. eventLoop. makeFailedFuture ( CodecError . requestDecoding ( error) )
114
114
case . success( let `in`) :
115
- return self . handle ( context: context, payload : `in`) . flatMapThrowing { out in
115
+ return self . handle ( context: context, event : `in`) . flatMapThrowing { out in
116
116
switch self . encodeOut ( allocator: context. allocator, value: out) {
117
117
case . failure( let error) :
118
118
throw CodecError . responseEncoding ( error)
@@ -159,11 +159,11 @@ public protocol ByteBufferLambdaHandler {
159
159
///
160
160
/// - parameters:
161
161
/// - context: Runtime `Context`.
162
- /// - payload : The event or request payload encoded as `ByteBuffer`.
162
+ /// - event : The event or input payload encoded as `ByteBuffer`.
163
163
///
164
164
/// - Returns: An `EventLoopFuture` to report the result of the Lambda back to the runtime engine.
165
165
/// The `EventLoopFuture` should be completed with either a response encoded as `ByteBuffer` or an `Error`
166
- func handle( context: Lambda . Context , payload : ByteBuffer ) -> EventLoopFuture < ByteBuffer ? >
166
+ func handle( context: Lambda . Context , event : ByteBuffer ) -> EventLoopFuture < ByteBuffer ? >
167
167
}
168
168
169
169
private enum CodecError : Error {
0 commit comments