@@ -39,20 +39,20 @@ public protocol LambdaHandler: EventLoopLambdaHandler {
3939 func handle( context: Lambda . Context , event: In , callback: @escaping ( Result < Out , Error > ) -> Void )
4040}
4141
42- internal extension Lambda {
43- static let defaultOffloadQueue = DispatchQueue ( label: " LambdaHandler.offload " )
42+ extension Lambda {
43+ internal static let defaultOffloadQueue = DispatchQueue ( label: " LambdaHandler.offload " )
4444}
4545
46- public extension LambdaHandler {
46+ extension LambdaHandler {
4747 /// The queue on which `handle` is invoked on.
48- var offloadQueue : DispatchQueue {
48+ public var offloadQueue : DispatchQueue {
4949 Lambda . defaultOffloadQueue
5050 }
5151
5252 /// `LambdaHandler` is offloading the processing to a `DispatchQueue`
5353 /// This is slower but safer, in case the implementation blocks the `EventLoop`
5454 /// Performance sensitive Lambdas should be based on `EventLoopLambdaHandler` which does not offload.
55- func handle( context: Lambda . Context , event: In ) -> EventLoopFuture < Out > {
55+ public func handle( context: Lambda . Context , event: In ) -> EventLoopFuture < Out > {
5656 let promise = context. eventLoop. makePromise ( of: Out . self)
5757 // FIXME: reusable DispatchQueue
5858 self . offloadQueue. async {
@@ -62,8 +62,8 @@ public extension LambdaHandler {
6262 }
6363}
6464
65- public extension LambdaHandler {
66- func shutdown( context: Lambda . ShutdownContext ) -> EventLoopFuture < Void > {
65+ extension LambdaHandler {
66+ public func shutdown( context: Lambda . ShutdownContext ) -> EventLoopFuture < Void > {
6767 let promise = context. eventLoop. makePromise ( of: Void . self)
6868 self . offloadQueue. async {
6969 do {
@@ -78,7 +78,7 @@ public extension LambdaHandler {
7878
7979 /// Clean up the Lambda resources synchronously.
8080 /// Concrete Lambda handlers implement this method to shutdown resources like `HTTPClient`s and database connections.
81- func syncShutdown( context: Lambda . ShutdownContext ) throws {
81+ public func syncShutdown( context: Lambda . ShutdownContext ) throws {
8282 // noop
8383 }
8484}
@@ -126,9 +126,9 @@ public protocol EventLoopLambdaHandler: ByteBufferLambdaHandler {
126126 func decode( buffer: ByteBuffer ) throws -> In
127127}
128128
129- public extension EventLoopLambdaHandler {
129+ extension EventLoopLambdaHandler {
130130 /// Driver for `ByteBuffer` -> `In` decoding and `Out` -> `ByteBuffer` encoding
131- func handle( context: Lambda . Context , event: ByteBuffer ) -> EventLoopFuture < ByteBuffer ? > {
131+ public func handle( context: Lambda . Context , event: ByteBuffer ) -> EventLoopFuture < ByteBuffer ? > {
132132 switch self . decodeIn ( buffer: event) {
133133 case . failure( let error) :
134134 return context. eventLoop. makeFailedFuture ( CodecError . requestDecoding ( error) )
@@ -162,8 +162,8 @@ public extension EventLoopLambdaHandler {
162162}
163163
164164/// Implementation of `ByteBuffer` to `Void` decoding
165- public extension EventLoopLambdaHandler where Out == Void {
166- func encode( allocator: ByteBufferAllocator , value: Void ) throws -> ByteBuffer ? {
165+ extension EventLoopLambdaHandler where Out == Void {
166+ public func encode( allocator: ByteBufferAllocator , value: Void ) throws -> ByteBuffer ? {
167167 nil
168168 }
169169}
@@ -194,8 +194,8 @@ public protocol ByteBufferLambdaHandler {
194194 func shutdown( context: Lambda . ShutdownContext ) -> EventLoopFuture < Void >
195195}
196196
197- public extension ByteBufferLambdaHandler {
198- func shutdown( context: Lambda . ShutdownContext ) -> EventLoopFuture < Void > {
197+ extension ByteBufferLambdaHandler {
198+ public func shutdown( context: Lambda . ShutdownContext ) -> EventLoopFuture < Void > {
199199 context. eventLoop. makeSucceededFuture ( ( ) )
200200 }
201201}
0 commit comments