pulsar-client-cpp
Loading...
Searching...
No Matches
Schema.h
1
19#pragma once
20
21#include <pulsar/defines.h>
22
23#include <iosfwd>
24#include <map>
25#include <memory>
26#include <string>
27
28namespace pulsar {
29
34{
39
43 INLINE
44};
45
46// Return string representation of result code
47PULSAR_PUBLIC const char *strEncodingType(pulsar::KeyValueEncodingType encodingType);
48
49PULSAR_PUBLIC KeyValueEncodingType enumEncodingType(std::string encodingTypeStr);
50
52{
56 NONE = 0,
57
61 STRING = 1,
62
66 JSON = 2,
67
72
76 AVRO = 4,
77
81 INT8 = 6,
82
86 INT16 = 7,
87
91 INT32 = 8,
92
96 INT64 = 9,
97
101 FLOAT = 10,
102
106 DOUBLE = 11,
107
112
117
121 BYTES = -1,
122
127
132};
133
134// Return string representation of result code
135PULSAR_PUBLIC const char *strSchemaType(SchemaType schemaType);
136
137PULSAR_PUBLIC SchemaType enumSchemaType(std::string schemaTypeStr);
138
139class SchemaInfoImpl;
140
141typedef std::map<std::string, std::string> StringMap;
142
146class PULSAR_PUBLIC SchemaInfo {
147 public:
159
166 SchemaInfo(SchemaType schemaType, const std::string &name, const std::string &schema,
167 const StringMap &properties = StringMap());
168
174 SchemaInfo(const SchemaInfo &keySchema, const SchemaInfo &valueSchema,
175 const KeyValueEncodingType &keyValueEncodingType = KeyValueEncodingType::INLINE);
176
181
185 const std::string &getName() const;
186
190 const std::string &getSchema() const;
191
195 const StringMap &getProperties() const;
196
197 private:
198 typedef std::shared_ptr<SchemaInfoImpl> SchemaInfoImplPtr;
199 SchemaInfoImplPtr impl_;
200};
201
202} // namespace pulsar
203
204PULSAR_PUBLIC std::ostream &operator<<(std::ostream &s, pulsar::SchemaType schemaType);
205
206PULSAR_PUBLIC std::ostream &operator<<(std::ostream &s, pulsar::KeyValueEncodingType encodingType);
Definition Schema.h:146
const StringMap & getProperties() const
SchemaType getSchemaType() const
SchemaInfo(SchemaType schemaType, const std::string &name, const std::string &schema, const StringMap &properties=StringMap())
SchemaInfo(const SchemaInfo &keySchema, const SchemaInfo &valueSchema, const KeyValueEncodingType &keyValueEncodingType=KeyValueEncodingType::INLINE)
const std::string & getSchema() const
const std::string & getName() const
Definition Authentication.h:31
KeyValueEncodingType
Definition Schema.h:34
SchemaType
Definition Schema.h:52
@ INT64
Definition Schema.h:96
@ JSON
Definition Schema.h:66
@ DOUBLE
Definition Schema.h:106
@ PROTOBUF_NATIVE
Definition Schema.h:116
@ INT8
Definition Schema.h:81
@ BYTES
Definition Schema.h:121
@ PROTOBUF
Definition Schema.h:71
@ FLOAT
Definition Schema.h:101
@ AUTO_CONSUME
Definition Schema.h:126
@ INT16
Definition Schema.h:86
@ KEY_VALUE
Definition Schema.h:111
@ STRING
Definition Schema.h:61
@ INT32
Definition Schema.h:91
@ AVRO
Definition Schema.h:76
@ AUTO_PUBLISH
Definition Schema.h:131
@ NONE
Definition Schema.h:56