@@ -17,33 +17,47 @@ import NIOCore
1717import NIOHTTP1
1818import NIOPosix
1919
20+ @usableFromInline
2021final actor LambdaRuntimeClient : LambdaRuntimeClientProtocol {
22+ @usableFromInline
2123 nonisolated let unownedExecutor : UnownedSerialExecutor
2224
23- struct Configuration {
25+ @usableFromInline
26+ struct Configuration : Sendable {
2427 var ip : String
2528 var port : Int
29+
30+ @usableFromInline
31+ init ( ip: String , port: Int ) {
32+ self . ip = ip
33+ self . port = port
34+ }
2635 }
2736
28- struct Writer : LambdaRuntimeClientResponseStreamWriter {
37+ @usableFromInline
38+ struct Writer : LambdaRuntimeClientResponseStreamWriter , Sendable {
2939 private var runtimeClient : LambdaRuntimeClient
3040
3141 fileprivate init ( runtimeClient: LambdaRuntimeClient ) {
3242 self . runtimeClient = runtimeClient
3343 }
3444
45+ @usableFromInline
3546 func write( _ buffer: NIOCore . ByteBuffer ) async throws {
3647 try await self . runtimeClient. write ( buffer)
3748 }
3849
50+ @usableFromInline
3951 func finish( ) async throws {
4052 try await self . runtimeClient. writeAndFinish ( nil )
4153 }
4254
55+ @usableFromInline
4356 func writeAndFinish( _ buffer: NIOCore . ByteBuffer ) async throws {
4457 try await self . runtimeClient. writeAndFinish ( buffer)
4558 }
4659
60+ @usableFromInline
4761 func reportError( _ error: any Error ) async throws {
4862 try await self . runtimeClient. reportError ( error)
4963 }
@@ -90,6 +104,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
90104 // being fully closed before we can return from it.
91105 private var closingConnections : [ any Channel ] = [ ]
92106
107+ @inlinable
93108 static func withRuntimeClient< Result> (
94109 configuration: Configuration ,
95110 eventLoop: any EventLoop ,
@@ -110,14 +125,16 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
110125 return try result. get ( )
111126 }
112127
113- private init ( configuration: Configuration , eventLoop: any EventLoop , logger: Logger ) {
128+ @usableFromInline
129+ init ( configuration: Configuration , eventLoop: any EventLoop , logger: Logger ) {
114130 self . unownedExecutor = eventLoop. executor. asUnownedSerialExecutor ( )
115131 self . configuration = configuration
116132 self . eventLoop = eventLoop
117133 self . logger = logger
118134 }
119135
120- private func close( ) async {
136+ @usableFromInline
137+ func close( ) async {
121138 self . logger. trace ( " Close lambda runtime client " )
122139
123140 guard case . notClosing = self . closingState else {
@@ -144,6 +161,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
144161 }
145162 }
146163
164+ @usableFromInline
147165 func nextInvocation( ) async throws -> ( Invocation , Writer ) {
148166 try await withTaskCancellationHandler {
149167 switch self . lambdaState {
0 commit comments