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/06/28 12:05:11 UTC

(iggy) 01/02: fix sdk

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

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

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

    fix sdk
---
 core/sdk/src/clients/client.rs           | 10 +++++-----
 core/sdk/src/clients/consumer.rs         | 10 +++++-----
 core/sdk/src/clients/consumer_builder.rs |  6 +++---
 core/sdk/src/clients/producer.rs         |  6 +++---
 core/sdk/src/clients/producer_builder.rs |  6 +++---
 core/sdk/src/http/http_client.rs         |  6 +++---
 6 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/core/sdk/src/clients/client.rs b/core/sdk/src/clients/client.rs
index 4896e629..a60892ba 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::http::http_client::HttpClient;
 use crate::prelude::EncryptorKind;
@@ -45,7 +45,7 @@ use tracing::{debug, error, info};
 #[derive(Debug)]
 #[allow(dead_code)]
 pub struct IggyClient {
-    pub(crate) client: IggySharedMut<Box<dyn Client>>,
+    pub(crate) client: IggyRwLock<Box<dyn Client>>,
     partitioner: Option<Arc<dyn Partitioner>>,
     pub(crate) encryptor: Option<Arc<EncryptorKind>>,
 }
@@ -71,7 +71,7 @@ impl IggyClient {
 
     /// Creates a new `IggyClient` with the provided client implementation for the specific transport.
     pub fn new(client: Box<dyn Client>) -> Self {
-        let client = IggySharedMut::new(client);
+        let client = IggyRwLock::new(client);
         IggyClient {
             client,
             partitioner: None,
@@ -106,7 +106,7 @@ impl IggyClient {
             info!("Client-side encryption is enabled.");
         }
 
-        let client = IggySharedMut::new(client);
+        let client = IggyRwLock::new(client);
         IggyClient {
             client,
             partitioner,
@@ -115,7 +115,7 @@ impl IggyClient {
     }
 
     /// Returns the underlying client implementation for the specific transport.
-    pub fn client(&self) -> IggySharedMut<Box<dyn Client>> {
+    pub fn client(&self) -> IggyRwLock<Box<dyn Client>> {
         self.client.clone()
     }
 
diff --git a/core/sdk/src/clients/consumer.rs b/core/sdk/src/clients/consumer.rs
index d0eeaf3a..99dd5197 100644
--- a/core/sdk/src/clients/consumer.rs
+++ b/core/sdk/src/clients/consumer.rs
@@ -21,7 +21,7 @@ use dashmap::DashMap;
 use futures::Stream;
 use futures_util::{FutureExt, StreamExt};
 use iggy_binary_protocol::Client;
-use iggy_common::locking::{IggySharedMut, IggySharedMutFn};
+use iggy_common::locking::{IggyRwLock, IggySharedMutFn};
 use iggy_common::{
     Consumer, ConsumerKind, DiagnosticEvent, EncryptorKind, IdKind, Identifier, IggyDuration,
     IggyError, IggyMessage, IggyTimestamp, PolledMessages, PollingKind, PollingStrategy,
@@ -93,7 +93,7 @@ unsafe impl Sync for IggyConsumer {}
 pub struct IggyConsumer {
     initialized: bool,
     can_poll: Arc<AtomicBool>,
-    client: IggySharedMut<Box<dyn Client>>,
+    client: IggyRwLock<Box<dyn Client>>,
     consumer_name: String,
     consumer: Arc<Consumer>,
     is_consumer_group: bool,
@@ -129,7 +129,7 @@ pub struct IggyConsumer {
 impl IggyConsumer {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
-        client: IggySharedMut<Box<dyn Client>>,
+        client: IggyRwLock<Box<dyn Client>>,
         consumer_name: String,
         consumer: Consumer,
         stream_id: Identifier,
@@ -405,7 +405,7 @@ impl IggyConsumer {
 
     #[allow(clippy::too_many_arguments)]
     async fn store_consumer_offset(
-        client: &IggySharedMut<Box<dyn Client>>,
+        client: &IggyRwLock<Box<dyn Client>>,
         consumer: &Consumer,
         stream_id: &Identifier,
         topic_id: &Identifier,
@@ -781,7 +781,7 @@ impl IggyConsumer {
     }
 
     async fn initialize_consumer_group(
-        client: IggySharedMut<Box<dyn Client>>,
+        client: IggyRwLock<Box<dyn Client>>,
         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 908a367c..425a765c 100644
--- a/core/sdk/src/clients/consumer_builder.rs
+++ b/core/sdk/src/clients/consumer_builder.rs
@@ -18,13 +18,13 @@
 
 use crate::prelude::{AutoCommit, AutoCommitWhen, IggyConsumer};
 use iggy_binary_protocol::Client;
-use iggy_common::locking::IggySharedMut;
+use iggy_common::locking::IggyRwLock;
 use iggy_common::{Consumer, EncryptorKind, Identifier, IggyDuration, PollingStrategy};
 use std::sync::Arc;
 
 #[derive(Debug)]
 pub struct IggyConsumerBuilder {
-    client: IggySharedMut<Box<dyn Client>>,
+    client: IggyRwLock<Box<dyn Client>>,
     consumer_name: String,
     consumer: Consumer,
     stream: Identifier,
@@ -46,7 +46,7 @@ pub struct IggyConsumerBuilder {
 impl IggyConsumerBuilder {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
-        client: IggySharedMut<Box<dyn Client>>,
+        client: IggyRwLock<Box<dyn Client>>,
         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 2c76b4ad..69d0042a 100644
--- a/core/sdk/src/clients/producer.rs
+++ b/core/sdk/src/clients/producer.rs
@@ -23,7 +23,7 @@ use crate::clients::producer_dispatcher::ProducerDispatcher;
 use bytes::Bytes;
 use futures_util::StreamExt;
 use iggy_binary_protocol::Client;
-use iggy_common::locking::{IggySharedMut, IggySharedMutFn};
+use iggy_common::locking::{IggyRwLock, IggySharedMutFn};
 use iggy_common::{
     CompressionAlgorithm, DiagnosticEvent, EncryptorKind, IdKind, Identifier, IggyDuration,
     IggyError, IggyExpiry, IggyMessage, IggyTimestamp, MaxTopicSize, Partitioner, Partitioning,
@@ -52,7 +52,7 @@ pub trait ProducerCoreBackend: Send + Sync + 'static {
 pub struct ProducerCore {
     initialized: AtomicBool,
     can_send: Arc<AtomicBool>,
-    client: Arc<IggySharedMut<Box<dyn Client>>>,
+    client: Arc<IggyRwLock<Box<dyn Client>>>,
     stream_id: Arc<Identifier>,
     stream_name: String,
     topic_id: Arc<Identifier>,
@@ -431,7 +431,7 @@ pub struct IggyProducer {
 impl IggyProducer {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
-        client: IggySharedMut<Box<dyn Client>>,
+        client: IggyRwLock<Box<dyn Client>>,
         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 fcd0c4a0..15abef42 100644
--- a/core/sdk/src/clients/producer_builder.rs
+++ b/core/sdk/src/clients/producer_builder.rs
@@ -18,7 +18,7 @@
 use crate::clients::producer_config::{BackgroundConfig, DirectConfig};
 use crate::prelude::IggyProducer;
 use iggy_binary_protocol::Client;
-use iggy_common::locking::IggySharedMut;
+use iggy_common::locking::IggyRwLock;
 use iggy_common::{
     EncryptorKind, Identifier, IggyDuration, IggyExpiry, MaxTopicSize, Partitioner, Partitioning,
 };
@@ -36,7 +36,7 @@ impl Default for SendMode {
 }
 
 pub struct IggyProducerBuilder {
-    client: IggySharedMut<Box<dyn Client>>,
+    client: IggyRwLock<Box<dyn Client>>,
     stream: Identifier,
     stream_name: String,
     topic: Identifier,
@@ -58,7 +58,7 @@ pub struct IggyProducerBuilder {
 impl IggyProducerBuilder {
     #[allow(clippy::too_many_arguments)]
     pub(crate) fn new(
-        client: IggySharedMut<Box<dyn Client>>,
+        client: IggyRwLock<Box<dyn Client>>,
         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),
         })
     }