@@ -32,12 +32,16 @@ public enum Lambda {
32
32
return String ( cString: value)
33
33
}
34
34
35
- // for testing and internal use
36
- internal static func run< Handler: ByteBufferLambdaHandler > (
37
- configuration: Configuration = . init( ) ,
38
- handlerType: Handler . Type
39
- ) -> Result < Int , Error > {
40
- let _run = { ( configuration: Configuration , handlerType: Handler . Type ) -> Result < Int , Error > in
35
+ /// Run a Lambda defined by implementing the ``ByteBufferLambdaHandler`` protocol.
36
+ /// The Runtime will manage the Lambdas application lifecycle automatically. It will invoke the
37
+ /// ``ByteBufferLambdaHandler/factory(context:)`` to create a new Handler.
38
+ ///
39
+ /// - parameters:
40
+ /// - factory: A `ByteBufferLambdaHandler` factory.
41
+ ///
42
+ /// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
43
+ internal static func run< Handler: ByteBufferLambdaHandler > ( configuration: Configuration = . init( ) , handlerType: Handler . Type ) -> Result < Int , Error > {
44
+ let _run = { ( configuration: Configuration ) -> Result < Int , Error > in
41
45
Backtrace . install ( )
42
46
var logger = Logger ( label: " Lambda " )
43
47
logger. logLevel = configuration. general. logLevel
@@ -76,17 +80,16 @@ public enum Lambda {
76
80
if Lambda . env ( " LOCAL_LAMBDA_SERVER_ENABLED " ) . flatMap ( Bool . init) ?? false {
77
81
do {
78
82
return try Lambda . withLocalServer {
79
- _run ( configuration, handlerType )
83
+ _run ( configuration)
80
84
}
81
85
} catch {
82
86
return . failure( error)
83
87
}
84
88
} else {
85
- return _run ( configuration, handlerType )
89
+ return _run ( configuration)
86
90
}
87
91
#else
88
92
return _run ( configuration, factory)
89
93
#endif
90
94
}
91
-
92
95
}
0 commit comments