@@ -6,12 +6,12 @@ public final class RedisDriver {
66 ///
77 /// Using `.eventLoopGroup` will allow an external provider to handle the lifetime of the `EventLoopGroup`,
88 /// while using `spawnThreads` will cause this `NIORedis` instance to handle the lifetime of a new `EventLoopGroup`.
9- public enum ExecutionModel {
10- case spawnThreads ( Int )
11- case eventLoopGroup ( EventLoopGroup )
9+ public enum ThreadOwnershipModel {
10+ case `internal` ( threadCount : Int )
11+ case external ( EventLoopGroup )
1212 }
1313
14- private let executionModel : ExecutionModel
14+ private let ownershipModel : ThreadOwnershipModel
1515 private let eventLoopGroup : EventLoopGroup
1616
1717 private let isRunning = Atomic < Bool > ( value: true )
@@ -20,14 +20,14 @@ public final class RedisDriver {
2020
2121 /// Creates a driver instance to create connections to a Redis.
2222 /// - Important: Call `terminate()` before deinitializing to properly cleanup resources.
23- /// - Parameter executionModel : The model to use for handling connection resources.
24- public init ( executionModel model: ExecutionModel ) {
25- self . executionModel = model
23+ /// - Parameter ownershipModel : The model to use for handling connection resources.
24+ public init ( ownershipModel model: ThreadOwnershipModel ) {
25+ self . ownershipModel = model
2626
2727 switch model {
28- case . spawnThreads ( let count) :
28+ case . internal ( let count) :
2929 self . eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: count)
30- case . eventLoopGroup ( let group) :
30+ case . external ( let group) :
3131 self . eventLoopGroup = group
3232 }
3333 }
@@ -37,9 +37,9 @@ public final class RedisDriver {
3737 public func terminate( ) throws {
3838 guard isRunning. exchange ( with: false ) else { return }
3939
40- switch executionModel {
41- case . spawnThreads : try self . eventLoopGroup. syncShutdownGracefully ( )
42- case . eventLoopGroup : return
40+ switch ownershipModel {
41+ case . internal : try self . eventLoopGroup. syncShutdownGracefully ( )
42+ case . external : return
4343 }
4444 }
4545
0 commit comments