Skip to content

Commit a3554bd

Browse files
committed
Public Lifecycle
1 parent dede451 commit a3554bd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/AWSLambdaRuntime/LambdaLifecycle.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ import NIO
1717
import NIOConcurrencyHelpers
1818

1919
extension Lambda {
20-
internal final class Lifecycle {
20+
public final class Lifecycle {
2121
private let eventLoop: EventLoop
2222
private let logger: Logger
2323
private let configuration: Configuration
2424
private let factory: LambdaHandlerFactory
2525

2626
private var _state = State.idle
2727
private let stateLock = Lock()
28+
29+
public convenience init(eventLoop: EventLoop, logger: Logger, factory: @escaping LambdaHandlerFactory) {
30+
self.init(eventLoop: eventLoop, logger: logger, configuration: .init(), factory: factory)
31+
}
2832

2933
init(eventLoop: EventLoop, logger: Logger, configuration: Configuration, factory: @escaping LambdaHandlerFactory) {
3034
self.eventLoop = eventLoop
@@ -53,7 +57,7 @@ extension Lambda {
5357
}
5458
}
5559

56-
func start() -> EventLoopFuture<Int> {
60+
public func start() -> EventLoopFuture<Int> {
5761
logger.info("lambda lifecycle starting with \(self.configuration)")
5862
self.state = .initializing
5963
var logger = self.logger
@@ -65,12 +69,12 @@ extension Lambda {
6569
}
6670
}
6771

68-
func stop() {
72+
public func stop() {
6973
self.logger.debug("lambda lifecycle stopping")
7074
self.state = .stopping
7175
}
7276

73-
func shutdown() {
77+
public func shutdown() {
7478
self.logger.debug("lambda lifecycle shutdown")
7579
self.state = .shutdown
7680
}

0 commit comments

Comments
 (0)