File tree 3 files changed +26
-25
lines changed
3 files changed +26
-25
lines changed Original file line number Diff line number Diff line change 18
18
// TODO: DocC: inherit documentation?
19
19
// TODO: DocC: take from lirbdkafka official documentation
20
20
// TODO: Topic config -> see KafkaConfig in SwiftKafka
21
- // TODO: create empty init for substructs to disable free initializer?
22
21
// TODO: test that values get set accordingly
23
22
// TODO: remove old config tests
24
- // TODO: magic nums for default values?
25
23
public protocol ClientConfig : Hashable , Equatable {
26
24
// TODO: docc
27
25
var properties : [ String : String ] { set get }
@@ -277,13 +275,4 @@ extension ClientConfig {
277
275
}
278
276
return ConfigEnums . SASLMechanism ( description: value)
279
277
}
280
-
281
- // TODO: move to Consumer
282
- func getAutoOffsetReset( ) -> ConfigEnums . AutoOffsetReset ? {
283
- guard let value = properties [ " auto.offset.reset " ] else {
284
- return nil
285
- }
286
- return ConfigEnums . AutoOffsetReset ( description: value)
287
- }
288
278
}
289
-
Original file line number Diff line number Diff line change 14
14
15
15
// TODO: docc
16
16
public struct ConfigEnums {
17
-
18
17
public struct DebugOption : Hashable , Equatable , CustomStringConvertible {
19
18
public let description : String
20
19
@@ -63,17 +62,4 @@ public struct ConfigEnums {
63
62
public static let scramSHA512 = SASLMechanism ( description: " SCRAM-SHA-512 " )
64
63
public static let oauthbearer = SASLMechanism ( description: " OAUTHBEARER " )
65
64
}
66
-
67
- // TODO: move to consumer? -> only used there
68
- public struct AutoOffsetReset : Hashable , Equatable , CustomStringConvertible {
69
- public let description : String
70
-
71
- public static let smallest = AutoOffsetReset ( description: " smallest " )
72
- public static let earliest = AutoOffsetReset ( description: " earliest " )
73
- public static let beginning = AutoOffsetReset ( description: " beginning " )
74
- public static let largest = AutoOffsetReset ( description: " largest " )
75
- public static let latest = AutoOffsetReset ( description: " latest " )
76
- public static let end = AutoOffsetReset ( description: " end " )
77
- public static let error = AutoOffsetReset ( description: " error " )
78
- }
79
65
}
Original file line number Diff line number Diff line change @@ -161,4 +161,30 @@ public struct ConsumerConfig: ClientConfig {
161
161
self . saslUsername = saslUsername
162
162
self . saslPassword = saslPassword
163
163
}
164
+
165
+ // MARK: - Helpers
166
+
167
+ func getAutoOffsetReset( ) -> ConfigEnums . AutoOffsetReset ? {
168
+ guard let value = properties [ " auto.offset.reset " ] else {
169
+ return nil
170
+ }
171
+ return ConfigEnums . AutoOffsetReset ( description: value)
172
+ }
173
+ }
174
+
175
+ // MARK: - ConfigEnums + AutoOffsetReset
176
+
177
+ extension ConfigEnums {
178
+ // TODO: docc
179
+ public struct AutoOffsetReset : Hashable , Equatable , CustomStringConvertible {
180
+ public let description : String
181
+
182
+ public static let smallest = AutoOffsetReset ( description: " smallest " )
183
+ public static let earliest = AutoOffsetReset ( description: " earliest " )
184
+ public static let beginning = AutoOffsetReset ( description: " beginning " )
185
+ public static let largest = AutoOffsetReset ( description: " largest " )
186
+ public static let latest = AutoOffsetReset ( description: " latest " )
187
+ public static let end = AutoOffsetReset ( description: " end " )
188
+ public static let error = AutoOffsetReset ( description: " error " )
189
+ }
164
190
}
You can’t perform that action at this time.
0 commit comments