@@ -6,12 +6,12 @@ public final class RedisDriver {
6
6
///
7
7
/// Using `.eventLoopGroup` will allow an external provider to handle the lifetime of the `EventLoopGroup`,
8
8
/// 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 )
12
12
}
13
13
14
- private let executionModel : ExecutionModel
14
+ private let ownershipModel : ThreadOwnershipModel
15
15
private let eventLoopGroup : EventLoopGroup
16
16
17
17
private let isRunning = Atomic < Bool > ( value: true )
@@ -20,14 +20,14 @@ public final class RedisDriver {
20
20
21
21
/// Creates a driver instance to create connections to a Redis.
22
22
/// - 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
26
26
27
27
switch model {
28
- case . spawnThreads ( let count) :
28
+ case . internal ( let count) :
29
29
self . eventLoopGroup = MultiThreadedEventLoopGroup ( numberOfThreads: count)
30
- case . eventLoopGroup ( let group) :
30
+ case . external ( let group) :
31
31
self . eventLoopGroup = group
32
32
}
33
33
}
@@ -37,9 +37,9 @@ public final class RedisDriver {
37
37
public func terminate( ) throws {
38
38
guard isRunning. exchange ( with: false ) else { return }
39
39
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
43
43
}
44
44
}
45
45
0 commit comments