Skip to content

Commit e6b8fc4

Browse files
committed
Reduced public exposure.
1 parent 09768ec commit e6b8fc4

File tree

11 files changed

+32
-31
lines changed

11 files changed

+32
-31
lines changed

Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ let package = Package(
3333
.product(name: "Backtrace", package: "swift-backtrace"),
3434
.product(name: "NIOHTTP1", package: "swift-nio"),
3535
]),
36+
.testTarget(name: "AWSLambdaRuntimeCoreTests", dependencies: [
37+
.byName(name: "AWSLambdaRuntimeCore"),
38+
]),
3639
.testTarget(name: "AWSLambdaRuntimeTests", dependencies: [
3740
.byName(name: "AWSLambdaRuntimeCore"),
3841
.byName(name: "AWSLambdaRuntime"),

Sources/AWSLambdaRuntime/Lambda+Codable.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension Lambda {
3030
///
3131
/// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
3232
public static func run<In: Decodable, Out: Encodable>(_ closure: @escaping CodableClosure<In, Out>) {
33-
self.run(closure: closure)
33+
self.run(CodableClosureWrapper(closure))
3434
}
3535

3636
/// An asynchronous Lambda Closure that takes a `In: Decodable` and returns a `Result<Void, Error>` via a completion handler.
@@ -43,20 +43,20 @@ extension Lambda {
4343
///
4444
/// - note: This is a blocking operation that will run forever, as its lifecycle is managed by the AWS Lambda Runtime Engine.
4545
public static func run<In: Decodable>(_ closure: @escaping CodableVoidClosure<In>) {
46-
self.run(closure: closure)
46+
self.run(CodableVoidClosureWrapper(closure))
4747
}
4848

49-
// for testing
50-
@discardableResult
51-
internal static func run<In: Decodable, Out: Encodable>(configuration: Configuration = .init(), closure: @escaping CodableClosure<In, Out>) -> Result<Int, Error> {
52-
self.run(configuration: configuration, handler: CodableClosureWrapper(closure))
53-
}
54-
55-
// for testing
56-
@discardableResult
57-
internal static func run<In: Decodable>(configuration: Configuration = .init(), closure: @escaping CodableVoidClosure<In>) -> Result<Int, Error> {
58-
self.run(configuration: configuration, handler: CodableVoidClosureWrapper(closure))
59-
}
49+
// // for testing
50+
// @discardableResult
51+
// internal static func run<In: Decodable, Out: Encodable>(configuration: Configuration = .init(), closure: @escaping CodableClosure<In, Out>) -> Result<Int, Error> {
52+
// self.run(configuration: configuration, handler: )
53+
// }
54+
//
55+
// // for testing
56+
// @discardableResult
57+
// internal static func run<In: Decodable>(configuration: Configuration = .init(), closure: @escaping CodableVoidClosure<In>) -> Result<Int, Error> {
58+
// self.run(configuration: configuration, handler: CodableVoidClosureWrapper(closure))
59+
// }
6060
}
6161

6262
internal struct CodableClosureWrapper<In: Decodable, Out: Encodable>: LambdaHandler {

Sources/AWSLambdaRuntimeCore/Lambda.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ public enum Lambda {
6464

6565
// for testing and internal use
6666
@discardableResult
67-
public static func run(configuration: Configuration = .init(), handler: Handler) -> Result<Int, Error> {
67+
internal static func run(configuration: Configuration = .init(), handler: Handler) -> Result<Int, Error> {
6868
self.run(configuration: configuration, factory: { $0.makeSucceededFuture(handler) })
6969
}
7070

7171
// for testing and internal use
7272
@discardableResult
73-
public static func run(configuration: Configuration = .init(), factory: @escaping (EventLoop) throws -> Handler) -> Result<Int, Error> {
73+
internal static func run(configuration: Configuration = .init(), factory: @escaping (EventLoop) throws -> Handler) -> Result<Int, Error> {
7474
self.run(configuration: configuration, factory: { eventloop -> EventLoopFuture<Handler> in
7575
do {
7676
let handler = try factory(eventloop)

Sources/AWSLambdaRuntimeCore/LambdaConfiguration.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import Logging
1717
import NIO
1818

1919
extension Lambda {
20-
public struct Configuration: CustomStringConvertible {
21-
public let general: General
22-
public let lifecycle: Lifecycle
23-
public let runtimeEngine: RuntimeEngine
20+
internal struct Configuration: CustomStringConvertible {
21+
let general: General
22+
let lifecycle: Lifecycle
23+
let runtimeEngine: RuntimeEngine
2424

25-
public init() {
25+
init() {
2626
self.init(general: .init(), lifecycle: .init(), runtimeEngine: .init())
2727
}
2828

@@ -32,19 +32,19 @@ extension Lambda {
3232
self.runtimeEngine = runtimeEngine ?? RuntimeEngine()
3333
}
3434

35-
public struct General: CustomStringConvertible {
35+
struct General: CustomStringConvertible {
3636
let logLevel: Logger.Level
3737

3838
init(logLevel: Logger.Level? = nil) {
3939
self.logLevel = logLevel ?? env("LOG_LEVEL").flatMap(Logger.Level.init) ?? .info
4040
}
4141

42-
public var description: String {
42+
var description: String {
4343
"\(General.self)(logLevel: \(self.logLevel))"
4444
}
4545
}
4646

47-
public struct Lifecycle: CustomStringConvertible {
47+
struct Lifecycle: CustomStringConvertible {
4848
let id: String
4949
let maxTimes: Int
5050
let stopSignal: Signal
@@ -56,12 +56,12 @@ extension Lambda {
5656
precondition(self.maxTimes >= 0, "maxTimes must be equal or larger than 0")
5757
}
5858

59-
public var description: String {
59+
var description: String {
6060
"\(Lifecycle.self)(id: \(self.id), maxTimes: \(self.maxTimes), stopSignal: \(self.stopSignal))"
6161
}
6262
}
6363

64-
public struct RuntimeEngine: CustomStringConvertible {
64+
struct RuntimeEngine: CustomStringConvertible {
6565
let ip: String
6666
let port: Int
6767
let keepAlive: Bool
@@ -78,12 +78,12 @@ extension Lambda {
7878
self.requestTimeout = requestTimeout ?? env("REQUEST_TIMEOUT").flatMap(Int64.init).flatMap { .milliseconds($0) }
7979
}
8080

81-
public var description: String {
81+
var description: String {
8282
"\(RuntimeEngine.self)(ip: \(self.ip), port: \(self.port), keepAlive: \(self.keepAlive), requestTimeout: \(String(describing: self.requestTimeout))"
8383
}
8484
}
8585

86-
public var description: String {
86+
var description: String {
8787
"\(Configuration.self)\n \(self.general))\n \(self.lifecycle)\n \(self.runtimeEngine)"
8888
}
8989
}

Tests/AWSLambdaRuntimeTests/Lambda+StringTest.swift renamed to Tests/AWSLambdaRuntimeCoreTests/Lambda+StringTest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
@testable import AWSLambdaRuntime
1615
@testable import AWSLambdaRuntimeCore
1716
import NIO
1817
import XCTest

Tests/AWSLambdaRuntimeTests/LambdaRuntimeClientTest.swift renamed to Tests/AWSLambdaRuntimeCoreTests/LambdaRuntimeClientTest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
@testable import AWSLambdaRuntime
1615
@testable import AWSLambdaRuntimeCore
1716
import XCTest
1817

Tests/AWSLambdaRuntimeTests/LambdaTest.swift renamed to Tests/AWSLambdaRuntimeCoreTests/LambdaTest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
@testable import AWSLambdaRuntime
1615
@testable import AWSLambdaRuntimeCore
1716
import Logging
1817
import NIO

Tests/AWSLambdaRuntimeTests/Utils.swift renamed to Tests/AWSLambdaRuntimeCoreTests/Utils.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
@testable import AWSLambdaRuntime
1615
@testable import AWSLambdaRuntimeCore
1716
import Logging
1817
import NIO

Tests/AWSLambdaRuntimeTests/Lambda+CodeableTest.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#if false
1516
@testable import AWSLambdaRuntime
1617
@testable import AWSLambdaRuntimeCore
1718
import NIO
@@ -279,3 +280,4 @@ private struct Response: Codable {
279280
self.requestId = requestId
280281
}
281282
}
283+
#endif

0 commit comments

Comments
 (0)