Skip to content

Commit

Permalink
* rename KafkaProducer.StateMachine.State.shutDown to .finished
Browse files Browse the repository at this point in the history
  • Loading branch information
felixschlegel committed Jun 26, 2023
1 parent d6805a7 commit 75e5b42
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/SwiftKafka/KafkaProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ extension KafkaProducer {
logger: Logger
)
/// The ``KafkaProducer`` has been shut down and cannot be used anymore.
case shutDown
case finished
}

/// The current state of the StateMachine.
Expand Down Expand Up @@ -414,7 +414,7 @@ extension KafkaProducer {
fatalError("\(#function) invoked while still in state \(self.state)")
case .started(let client, _, _, _, _):
return .poll(client: client)
case .shutDown:
case .finished:
return .killPollLoop
}
}
Expand All @@ -441,7 +441,7 @@ extension KafkaProducer {
} else {
return .createTopicHandle(client: client, topic: topic)
}
case .shutDown:
case .finished:
throw KafkaError.connectionClosed(reason: "Tried to create topic handle on closed connection")
}
}
Expand All @@ -464,7 +464,7 @@ extension KafkaProducer {
topicHandles: topicHandles,
logger: logger
)
case .shutDown:
case .finished:
throw KafkaError.connectionClosed(reason: "Tried to create topic handle on closed connection")
}
}
Expand Down Expand Up @@ -500,7 +500,7 @@ extension KafkaProducer {
client: client,
newMessageID: newMessageID
)
case .shutDown:
case .finished:
throw KafkaError.connectionClosed(reason: "Tried to produce a message with a closed producer")
}
}
Expand Down Expand Up @@ -528,13 +528,13 @@ extension KafkaProducer {
case .uninitialized:
fatalError("\(#function) invoked while still in state \(self.state)")
case .started(let client, _, let source, let topicHandles, _):
self.state = .shutDown
self.state = .finished
return .shutdownGracefullyAndFinishSource(
client: client,
source: source,
topicHandles: topicHandles
)
case .shutDown:
case .finished:
return nil
}
}
Expand Down

0 comments on commit 75e5b42

Please sign in to comment.