@@ -17,33 +17,47 @@ import NIOCore
17
17
import NIOHTTP1
18
18
import NIOPosix
19
19
20
+ @usableFromInline
20
21
final actor LambdaRuntimeClient : LambdaRuntimeClientProtocol {
22
+ @usableFromInline
21
23
nonisolated let unownedExecutor : UnownedSerialExecutor
22
24
23
- struct Configuration {
25
+ @usableFromInline
26
+ struct Configuration : Sendable {
24
27
var ip : String
25
28
var port : Int
29
+
30
+ @usableFromInline
31
+ init ( ip: String , port: Int ) {
32
+ self . ip = ip
33
+ self . port = port
34
+ }
26
35
}
27
36
28
- struct Writer : LambdaRuntimeClientResponseStreamWriter {
37
+ @usableFromInline
38
+ struct Writer : LambdaRuntimeClientResponseStreamWriter , Sendable {
29
39
private var runtimeClient : LambdaRuntimeClient
30
40
31
41
fileprivate init ( runtimeClient: LambdaRuntimeClient ) {
32
42
self . runtimeClient = runtimeClient
33
43
}
34
44
45
+ @usableFromInline
35
46
func write( _ buffer: NIOCore . ByteBuffer ) async throws {
36
47
try await self . runtimeClient. write ( buffer)
37
48
}
38
49
50
+ @usableFromInline
39
51
func finish( ) async throws {
40
52
try await self . runtimeClient. writeAndFinish ( nil )
41
53
}
42
54
55
+ @usableFromInline
43
56
func writeAndFinish( _ buffer: NIOCore . ByteBuffer ) async throws {
44
57
try await self . runtimeClient. writeAndFinish ( buffer)
45
58
}
46
59
60
+ @usableFromInline
47
61
func reportError( _ error: any Error ) async throws {
48
62
try await self . runtimeClient. reportError ( error)
49
63
}
@@ -90,6 +104,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
90
104
// being fully closed before we can return from it.
91
105
private var closingConnections : [ any Channel ] = [ ]
92
106
107
+ @inlinable
93
108
static func withRuntimeClient< Result> (
94
109
configuration: Configuration ,
95
110
eventLoop: any EventLoop ,
@@ -110,14 +125,16 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
110
125
return try result. get ( )
111
126
}
112
127
113
- private init ( configuration: Configuration , eventLoop: any EventLoop , logger: Logger ) {
128
+ @usableFromInline
129
+ init ( configuration: Configuration , eventLoop: any EventLoop , logger: Logger ) {
114
130
self . unownedExecutor = eventLoop. executor. asUnownedSerialExecutor ( )
115
131
self . configuration = configuration
116
132
self . eventLoop = eventLoop
117
133
self . logger = logger
118
134
}
119
135
120
- private func close( ) async {
136
+ @usableFromInline
137
+ func close( ) async {
121
138
self . logger. trace ( " Close lambda runtime client " )
122
139
123
140
guard case . notClosing = self . closingState else {
@@ -144,6 +161,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
144
161
}
145
162
}
146
163
164
+ @usableFromInline
147
165
func nextInvocation( ) async throws -> ( Invocation , Writer ) {
148
166
try await withTaskCancellationHandler {
149
167
switch self . lambdaState {
0 commit comments