@@ -34,31 +34,24 @@ public enum Lambda {
3434 ///
3535 /// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
3636
37- internal static func run< Handler: ByteBufferLambdaHandler > (
37+ @available ( macOS 12 , iOS 15 , tvOS 15 , watchOS 8 , * )
38+ internal static func run< Handler: LambdaHandler > (
3839 configuration: LambdaConfiguration = . init( ) ,
3940 handlerType: Handler . Type
4041 ) -> Result < Int , Error > {
41- Self . run ( configuration: configuration, initializationHandler : Handler . makeHandler ( context : ) )
42+ Self . run ( configuration: configuration, handlerType : CodableLambdaHandler < Handler, Handler . Event , Handler . Output > . self )
4243 }
4344
4445 internal static func run< Handler: EventLoopLambdaHandler > (
4546 configuration: LambdaConfiguration = . init( ) ,
4647 handlerType: Handler . Type
4748 ) -> Result < Int , Error > {
48- Self . run ( configuration: configuration, initializationHandler : Handler . makeHandler ( context : ) )
49+ Self . run ( configuration: configuration, handlerType : CodableEventLoopLambdaHandler < Handler, Handler . Event , Handler . Output > . self )
4950 }
5051
51- @available ( macOS 12 , * )
52- internal static func run< Handler: LambdaHandler > (
52+ internal static func run< Handler: ByteBufferLambdaHandler > (
5353 configuration: LambdaConfiguration = . init( ) ,
5454 handlerType: Handler . Type
55- ) -> Result < Int , Error > {
56- Self . run ( configuration: configuration, initializationHandler: Handler . makeHandler ( context: ) )
57-
58- }
59- private static func run(
60- configuration: LambdaConfiguration = . init( ) ,
61- initializationHandler: @escaping _InitializationHandler
6255 ) -> Result < Int , Error > {
6356 let _run = { ( configuration: LambdaConfiguration ) -> Result < Int , Error > in
6457 Backtrace . install ( )
@@ -67,7 +60,7 @@ public enum Lambda {
6760
6861 var result : Result < Int , Error > !
6962 MultiThreadedEventLoopGroup . withCurrentThreadAsEventLoop { eventLoop in
70- let runtime = LambdaRuntime ( eventLoop: eventLoop, logger: logger, configuration: configuration, initializationHandler : initializationHandler )
63+ let runtime = LambdaRuntime ( handlerType , eventLoop: eventLoop, logger: logger, configuration: configuration)
7164 #if DEBUG
7265 let signalSource = trap ( signal: configuration. lifecycle. stopSignal) { signal in
7366 logger. info ( " intercepted signal: \( signal) " )
@@ -89,7 +82,6 @@ public enum Lambda {
8982 result = lifecycleResult
9083 }
9184 }
92-
9385 logger. info ( " shutdown completed " )
9486 return result
9587 }
0 commit comments