slbotbm commented on code in PR #4022:
URL: https://github.com/apache/iggy/pull/4022#discussion_r3991295833


##########
foreign/cpp/src/client.cpp:
##########
@@ -55,13 +55,251 @@ void IggyBlockingClient::Shutdown() {
 
 LoginInfo IggyBlockingClient::Login(std::string username, std::string 
password) {
     return RethrowAsIggyException(
-        [this, &username, &password] { return 
Handle()->login_user(std::move(username), std::move(password)); });
+        [this, &username, &password] { return 
LoginInfo::FromFfi(Handle()->login_user(username, password)); });
 }
 
 void IggyBlockingClient::Logout() {
     RethrowAsIggyException([this] { Handle()->logout_user(); });
 }
 
+StreamDetails IggyBlockingClient::CreateStream(std::string name) {
+    return RethrowAsIggyException([this, &name] { return 
StreamDetails::FromFfi(Handle()->create_stream(name)); });
+}
+
+void IggyBlockingClient::UpdateStream(const Identifier &stream, std::string 
name, const StreamUpdateOptions &options) {
+    RethrowAsIggyException([this, &stream, &name, &options] {
+        rust::Vec<ffi::HeaderEntry> ffi_options;
+        ffi_options.reserve(options.RawEntries().size());
+        for (const auto &entry : options.RawEntries()) {
+            ffi::HeaderEntry ffi_entry;
+            ffi_entry.key.kind = static_cast<std::uint8_t>(HeaderKind::String);
+            ffi_entry.key.value.reserve(entry.first.size());
+            for (char character : entry.first) {
+                
ffi_entry.key.value.push_back(static_cast<std::uint8_t>(character));
+            }
+            ffi_entry.value.kind = 
static_cast<std::uint8_t>(HeaderKind::String);
+            ffi_entry.value.value.reserve(entry.second.size());
+            for (char character : entry.second) {
+                
ffi_entry.value.value.push_back(static_cast<std::uint8_t>(character));
+            }
+            ffi_options.push_back(std::move(ffi_entry));
+        }
+        Handle()->update_stream(stream.ToFfi(), name, std::move(ffi_options));
+    });
+}
+
+std::vector<Stream> IggyBlockingClient::GetStreams() {
+    return RethrowAsIggyException([this] {
+        std::vector<Stream> streams;
+        auto ffi_streams = Handle()->get_streams();
+        streams.reserve(ffi_streams.size());
+        for (auto &stream : ffi_streams) {
+            streams.push_back(Stream::FromFfi(std::move(stream)));
+        }
+        return streams;
+    });
+}
+
+StreamDetails IggyBlockingClient::GetStream(const Identifier &stream) {
+    return RethrowAsIggyException(
+        [this, &stream] { return 
StreamDetails::FromFfi(Handle()->get_stream(stream.ToFfi())); });
+}
+
+void IggyBlockingClient::DeleteStream(const Identifier &stream) {
+    RethrowAsIggyException([this, &stream] { 
Handle()->delete_stream(stream.ToFfi()); });
+}
+
+void IggyBlockingClient::PurgeStream(const Identifier &stream) {
+    RethrowAsIggyException([this, &stream] { 
Handle()->purge_stream(stream.ToFfi()); });
+}
+
+TopicDetails IggyBlockingClient::CreateTopic(const Identifier &stream,
+                                             std::string name,
+                                             const TopicCreateOptions 
&options) {
+    return RethrowAsIggyException([this, &stream, &name, &options] {
+        ffi::TopicCreateOptions ffi_options;

Review Comment:
   done



-- 
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]

Reply via email to