ethanlin01x commented on code in PR #3877:
URL: https://github.com/apache/iggy/pull/3877#discussion_r3821787996
##########
foreign/python/src/consumer.rs:
##########
@@ -215,6 +215,29 @@ impl IggyConsumer {
}
}
+/// The consumer polling the messages. It selects both the consumer kind and
the
+/// identifier the server keys the stored offset on.
+#[derive(Clone)]
+#[gen_stub_pyclass_complex_enum]
+#[pyclass(from_py_object)]
+pub enum Consumer {
+ /// A regular consumer, owning its offset on the polled partition.
+ Single { id: PyIdentifier },
+ /// A member of the consumer group, sharing the group's offset.
+ Group { id: PyIdentifier },
+}
+
+impl TryFrom<&Consumer> for RustConsumer {
+ type Error = PyErr;
+
+ fn try_from(value: &Consumer) -> PyResult<RustConsumer> {
+ Ok(match value {
+ Consumer::Single { id } =>
RustConsumer::new(Identifier::try_from(id.clone())?),
Review Comment:
88d84c8693dc9cb3d20ca85bad7a420d2515b739
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]