You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by gk...@apache.org on 2025/07/14 10:07:32 UTC

(iggy) 16/45: fix sdk

This is an automated email from the ASF dual-hosted git repository.

gkoszyk pushed a commit to branch merge_master
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 859ac1751a0a382a5869f6953bf3849aaea66055
Author: numinex <g....@gmail.com>
AuthorDate: Fri Jun 27 16:50:29 2025 +0200

    fix sdk
---
 Cargo.lock                               | 11 ++++++++++-
 core/sdk/src/clients/client.rs           | 17 +++++++++++++++--
 core/sdk/src/clients/consumer.rs         | 21 +++++++++++++++++++++
 core/sdk/src/clients/consumer_builder.rs | 13 +++++++++++++
 core/sdk/src/clients/producer.rs         | 13 +++++++++++++
 core/sdk/src/clients/producer_builder.rs | 13 +++++++++++++
 core/sdk/src/http/http_client.rs         |  6 +++---
 7 files changed, 88 insertions(+), 6 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index a8a3dfb5..2789df06 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4864,6 +4864,15 @@ version = "2.7.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
 
+[[package]]
+name = "memoffset"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
+dependencies = [
+ "autocfg",
+]
+
 [[package]]
 name = "miette"
 version = "7.6.0"
@@ -7521,7 +7530,7 @@ dependencies = [
  "futures-util",
  "hashbrown 0.15.4",
  "hashlink",
- "indexmap 2.9.0",
+ "indexmap 2.10.0",
  "log",
  "memchr",
  "once_cell",
diff --git a/core/sdk/src/clients/client.rs b/core/sdk/src/clients/client.rs
index 659cd3ba..215b9790 100644
--- a/core/sdk/src/clients/client.rs
+++ b/core/sdk/src/clients/client.rs
@@ -17,7 +17,7 @@
  */
 
 use crate::clients::client_builder::IggyClientBuilder;
-use iggy_common::locking::{IggySharedMut, IggySharedMutFn};
+use iggy_common::locking::{IggyRwLock, IggySharedMutFn};
 
 use crate::client_wrappers::client_wrapper::ClientWrapper;
 use crate::http::http_client::HttpClient;
@@ -46,7 +46,11 @@ use tracing::{debug, error, info};
 #[derive(Debug)]
 #[allow(dead_code)]
 pub struct IggyClient {
+<<<<<<< HEAD
     pub(crate) client: IggySharedMut<ClientWrapper>,
+=======
+    pub(crate) client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
     partitioner: Option<Arc<dyn Partitioner>>,
     pub(crate) encryptor: Option<Arc<EncryptorKind>>,
 }
@@ -71,8 +75,13 @@ impl IggyClient {
     }
 
     /// Creates a new `IggyClient` with the provided client implementation for the specific transport.
+<<<<<<< HEAD
     pub fn new(client: ClientWrapper) -> Self {
         let client = IggySharedMut::new(client);
+=======
+    pub fn new(client: Box<dyn Client>) -> Self {
+        let client = IggyRwLock::new(client);
+>>>>>>> 639a9a88 (fix sdk)
         IggyClient {
             client,
             partitioner: None,
@@ -107,7 +116,7 @@ impl IggyClient {
             info!("Client-side encryption is enabled.");
         }
 
-        let client = IggySharedMut::new(client);
+        let client = IggyRwLock::new(client);
         IggyClient {
             client,
             partitioner,
@@ -116,7 +125,11 @@ impl IggyClient {
     }
 
     /// Returns the underlying client implementation for the specific transport.
+<<<<<<< HEAD
     pub fn client(&self) -> IggySharedMut<ClientWrapper> {
+=======
+    pub fn client(&self) -> IggyRwLock<Box<dyn Client>> {
+>>>>>>> 639a9a88 (fix sdk)
         self.client.clone()
     }
 
diff --git a/core/sdk/src/clients/consumer.rs b/core/sdk/src/clients/consumer.rs
index 1c5fb728..b953b8aa 100644
--- a/core/sdk/src/clients/consumer.rs
+++ b/core/sdk/src/clients/consumer.rs
@@ -21,10 +21,15 @@ use bytes::Bytes;
 use dashmap::DashMap;
 use futures::Stream;
 use futures_util::{FutureExt, StreamExt};
+<<<<<<< HEAD
 use iggy_binary_protocol::{
     Client, ConsumerGroupClient, ConsumerOffsetClient, MessageClient, StreamClient, TopicClient,
 };
 use iggy_common::locking::{IggySharedMut, IggySharedMutFn};
+=======
+use iggy_binary_protocol::Client;
+use iggy_common::locking::{IggyRwLock, IggySharedMutFn};
+>>>>>>> 639a9a88 (fix sdk)
 use iggy_common::{
     Consumer, ConsumerKind, DiagnosticEvent, EncryptorKind, IdKind, Identifier, IggyDuration,
     IggyError, IggyMessage, IggyTimestamp, PolledMessages, PollingKind, PollingStrategy,
@@ -96,7 +101,11 @@ unsafe impl Sync for IggyConsumer {}
 pub struct IggyConsumer {
     initialized: bool,
     can_poll: Arc<AtomicBool>,
+<<<<<<< HEAD
     client: IggySharedMut<ClientWrapper>,
+=======
+    client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
     consumer_name: String,
     consumer: Arc<Consumer>,
     is_consumer_group: bool,
@@ -132,7 +141,11 @@ pub struct IggyConsumer {
 impl IggyConsumer {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
+<<<<<<< HEAD
         client: IggySharedMut<ClientWrapper>,
+=======
+        client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
         consumer_name: String,
         consumer: Consumer,
         stream_id: Identifier,
@@ -408,7 +421,11 @@ impl IggyConsumer {
 
     #[allow(clippy::too_many_arguments)]
     async fn store_consumer_offset(
+<<<<<<< HEAD
         client: &IggySharedMut<ClientWrapper>,
+=======
+        client: &IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
         consumer: &Consumer,
         stream_id: &Identifier,
         topic_id: &Identifier,
@@ -784,7 +801,11 @@ impl IggyConsumer {
     }
 
     async fn initialize_consumer_group(
+<<<<<<< HEAD
         client: IggySharedMut<ClientWrapper>,
+=======
+        client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
         create_consumer_group_if_not_exists: bool,
         stream_id: Arc<Identifier>,
         topic_id: Arc<Identifier>,
diff --git a/core/sdk/src/clients/consumer_builder.rs b/core/sdk/src/clients/consumer_builder.rs
index 576d841e..33e0c101 100644
--- a/core/sdk/src/clients/consumer_builder.rs
+++ b/core/sdk/src/clients/consumer_builder.rs
@@ -18,13 +18,22 @@
 
 use crate::client_wrappers::client_wrapper::ClientWrapper;
 use crate::prelude::{AutoCommit, AutoCommitWhen, IggyConsumer};
+<<<<<<< HEAD
 use iggy_common::locking::IggySharedMut;
+=======
+use iggy_binary_protocol::Client;
+use iggy_common::locking::IggyRwLock;
+>>>>>>> 639a9a88 (fix sdk)
 use iggy_common::{Consumer, EncryptorKind, Identifier, IggyDuration, PollingStrategy};
 use std::sync::Arc;
 
 #[derive(Debug)]
 pub struct IggyConsumerBuilder {
+<<<<<<< HEAD
     client: IggySharedMut<ClientWrapper>,
+=======
+    client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
     consumer_name: String,
     consumer: Consumer,
     stream: Identifier,
@@ -46,7 +55,11 @@ pub struct IggyConsumerBuilder {
 impl IggyConsumerBuilder {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
+<<<<<<< HEAD
         client: IggySharedMut<ClientWrapper>,
+=======
+        client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
         consumer_name: String,
         consumer: Consumer,
         stream_id: Identifier,
diff --git a/core/sdk/src/clients/producer.rs b/core/sdk/src/clients/producer.rs
index 5eee0e25..5b007ab2 100644
--- a/core/sdk/src/clients/producer.rs
+++ b/core/sdk/src/clients/producer.rs
@@ -23,8 +23,13 @@ use crate::clients::producer_config::DirectConfig;
 use crate::clients::producer_dispatcher::ProducerDispatcher;
 use bytes::Bytes;
 use futures_util::StreamExt;
+<<<<<<< HEAD
 use iggy_binary_protocol::{Client, MessageClient, StreamClient, TopicClient};
 use iggy_common::locking::{IggySharedMut, IggySharedMutFn};
+=======
+use iggy_binary_protocol::Client;
+use iggy_common::locking::{IggyRwLock, IggySharedMutFn};
+>>>>>>> 639a9a88 (fix sdk)
 use iggy_common::{
     CompressionAlgorithm, DiagnosticEvent, EncryptorKind, IdKind, Identifier, IggyDuration,
     IggyError, IggyExpiry, IggyMessage, IggyTimestamp, MaxTopicSize, Partitioner, Partitioning,
@@ -53,7 +58,11 @@ pub trait ProducerCoreBackend: Send + Sync + 'static {
 pub struct ProducerCore {
     initialized: AtomicBool,
     can_send: Arc<AtomicBool>,
+<<<<<<< HEAD
     client: Arc<IggySharedMut<ClientWrapper>>,
+=======
+    client: Arc<IggyRwLock<Box<dyn Client>>>,
+>>>>>>> 639a9a88 (fix sdk)
     stream_id: Arc<Identifier>,
     stream_name: String,
     topic_id: Arc<Identifier>,
@@ -432,7 +441,11 @@ pub struct IggyProducer {
 impl IggyProducer {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
+<<<<<<< HEAD
         client: IggySharedMut<ClientWrapper>,
+=======
+        client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
         stream: Identifier,
         stream_name: String,
         topic: Identifier,
diff --git a/core/sdk/src/clients/producer_builder.rs b/core/sdk/src/clients/producer_builder.rs
index ae8bb368..d3163543 100644
--- a/core/sdk/src/clients/producer_builder.rs
+++ b/core/sdk/src/clients/producer_builder.rs
@@ -18,7 +18,12 @@
 use crate::client_wrappers::client_wrapper::ClientWrapper;
 use crate::clients::producer_config::{BackgroundConfig, DirectConfig};
 use crate::prelude::IggyProducer;
+<<<<<<< HEAD
 use iggy_common::locking::IggySharedMut;
+=======
+use iggy_binary_protocol::Client;
+use iggy_common::locking::IggyRwLock;
+>>>>>>> 639a9a88 (fix sdk)
 use iggy_common::{
     EncryptorKind, Identifier, IggyDuration, IggyExpiry, MaxTopicSize, Partitioner, Partitioning,
 };
@@ -36,7 +41,11 @@ impl Default for SendMode {
 }
 
 pub struct IggyProducerBuilder {
+<<<<<<< HEAD
     client: IggySharedMut<ClientWrapper>,
+=======
+    client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
     stream: Identifier,
     stream_name: String,
     topic: Identifier,
@@ -58,7 +67,11 @@ pub struct IggyProducerBuilder {
 impl IggyProducerBuilder {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
+<<<<<<< HEAD
         client: IggySharedMut<ClientWrapper>,
+=======
+        client: IggyRwLock<Box<dyn Client>>,
+>>>>>>> 639a9a88 (fix sdk)
         stream: Identifier,
         stream_name: String,
         topic: Identifier,
diff --git a/core/sdk/src/http/http_client.rs b/core/sdk/src/http/http_client.rs
index be619dad..6c6eb066 100644
--- a/core/sdk/src/http/http_client.rs
+++ b/core/sdk/src/http/http_client.rs
@@ -20,7 +20,7 @@ use crate::http::http_transport::HttpTransport;
 use crate::prelude::{Client, HttpClientConfig, IggyDuration, IggyError};
 use async_broadcast::{Receiver, Sender, broadcast};
 use async_trait::async_trait;
-use iggy_common::locking::{IggySharedMut, IggySharedMutFn};
+use iggy_common::locking::{IggyRwLock, IggySharedMutFn};
 use iggy_common::{
     ConnectionString, ConnectionStringUtils, DiagnosticEvent, HttpConnectionStringOptions,
     IdentityInfo, TransportProtocol,
@@ -51,7 +51,7 @@ pub struct HttpClient {
     pub api_url: Url,
     pub(crate) heartbeat_interval: IggyDuration,
     client: ClientWithMiddleware,
-    access_token: IggySharedMut<String>,
+    access_token: IggyRwLock<String>,
     events: (Sender<DiagnosticEvent>, Receiver<DiagnosticEvent>),
 }
 
@@ -280,7 +280,7 @@ impl HttpClient {
             api_url,
             client,
             heartbeat_interval: IggyDuration::from_str("5s").unwrap(),
-            access_token: IggySharedMut::new("".to_string()),
+            access_token: IggyRwLock::new("".to_string()),
             events: broadcast(1000),
         })
     }