BewareMyPower commented on code in PR #17125:
URL: https://github.com/apache/pulsar/pull/17125#discussion_r951116528
##########
pulsar-client-cpp/include/pulsar/Schema.h:
##########
@@ -143,6 +162,14 @@ class PULSAR_PUBLIC SchemaInfo {
SchemaInfo(SchemaType schemaType, const std::string &name, const
std::string &schema,
const StringMap &properties = StringMap());
+ /**
+ * @param keySchema the key schema.
+ * @param valueSchema the value schema.
+ * @param keyValueEncodingType Encoding types of supported KeyValueSchema
for Pulsar messages.
+ */
+ SchemaInfo(const SchemaInfo &keySchema, const SchemaInfo &valueSchema,
+ const KeyValueEncodingType &keyValueEncodingType);
Review Comment:
I think we can add a default value (`INLINE`) for it.
```suggestion
SchemaInfo(const SchemaInfo &keySchema, const SchemaInfo &valueSchema,
const KeyValueEncodingType &keyValueEncodingType =
KeyValueEncodingType::INLINE);
```
##########
pulsar-client-cpp/include/pulsar/Schema.h:
##########
@@ -27,6 +27,25 @@
namespace pulsar {
+/**
+ * Encoding types of supported KeyValueSchema for Pulsar messages.
+ */
+enum KeyValueEncodingType
+{
+ /**
+ * Key is stored as message key, while value is stored as message payload.
+ */
+ SEPARATED,
+
+ /**
+ * Key and value are stored as message payload.
+ */
+ INLINE
+};
+
+// Return string representation of result code
+PULSAR_PUBLIC const char *strEncodingType(KeyValueEncodingType schemaType);
Review Comment:
Override `operator<<` rather than providing another function. See how we
deal with `Result`. The `strResult` function is a legacy function.
##########
pulsar-client-cpp/include/pulsar/Schema.h:
##########
@@ -27,6 +27,25 @@
namespace pulsar {
+/**
+ * Encoding types of supported KeyValueSchema for Pulsar messages.
+ */
+enum KeyValueEncodingType
Review Comment:
I recommended `enum class` rather than `enum` for new APIs. With an enum
class, you must write `KeyValueEncodingType::INLINE`, but with a normal enum,
you can write `KeyValueEncodingType::INLINE` or `INLINE`. See
https://stackoverflow.com/questions/18335861/why-is-enum-class-preferred-over-plain-enum
--
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]