From f96ed65f79c3c97973ffae44cbb1737009f00515 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 10 Oct 2023 22:43:37 +0200 Subject: [PATCH] Fix Lint & Docs --- memphis/src/consumer/memphis_consumer.rs | 4 ---- memphis/src/memphis_client.rs | 2 +- memphis/src/station/memphis_station.rs | 14 ++++++-------- memphis/tests/consumer_tests.rs | 2 +- memphis/tests/message_tests.rs | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/memphis/src/consumer/memphis_consumer.rs b/memphis/src/consumer/memphis_consumer.rs index 358ab17..f23c1f1 100644 --- a/memphis/src/consumer/memphis_consumer.rs +++ b/memphis/src/consumer/memphis_consumer.rs @@ -10,7 +10,6 @@ use tokio_util::sync::CancellationToken; use crate::constants::memphis_constants::{MemphisSpecialStation, MemphisSubscriptions}; use crate::consumer::consumer_error::ConsumerError; -use crate::consumer::event::MemphisEvent; use crate::consumer::memphis_consumer_options::MemphisConsumerOptions; use crate::consumer::MemphisMessage; use crate::helper::memphis_util::{get_internal_name, sanitize_name}; @@ -117,9 +116,6 @@ impl MemphisConsumer { /// /// The messages will be sent to the **message_receiver**. /// - /// * If the station is not available, the [StationUnavailable](MemphisEvent::StationUnavailable) event will be sent. - /// * If the consumer is not available, the [ConsumerUnavailable](MemphisEvent::ConsumerUnavailable) event will be sent. - /// /// # Example /// ```rust /// use memphis_rust_community::memphis_client::MemphisClient; diff --git a/memphis/src/memphis_client.rs b/memphis/src/memphis_client.rs index 2fc65ec..0ae28f9 100644 --- a/memphis/src/memphis_client.rs +++ b/memphis/src/memphis_client.rs @@ -5,7 +5,7 @@ use async_nats::connection::State; use async_nats::jetstream::Context; use async_nats::{jetstream, Client, ConnectError, ConnectOptions, Event, Message}; use bytes::Bytes; -use log::{error, info}; +use log::info; use serde::Serialize; use uuid::Uuid; diff --git a/memphis/src/station/memphis_station.rs b/memphis/src/station/memphis_station.rs index 863dc2b..da980a0 100644 --- a/memphis/src/station/memphis_station.rs +++ b/memphis/src/station/memphis_station.rs @@ -1,9 +1,5 @@ -use std::io::Cursor; use std::sync::Arc; -use log::{error, info}; -use murmur3::murmur3_32; - use crate::constants::memphis_constants::MemphisSpecialStation; use crate::helper::memphis_util::get_internal_name; use crate::memphis_client::MemphisClient; @@ -12,8 +8,9 @@ use crate::models::request::{CreateStationRequest, DestroyStationRequest, DlsCon use crate::schemaverse::schema::SchemaValidator; use crate::station::memphis_station_options::MemphisStationsOptions; use crate::RequestError; +use log::{error, info}; -static SEED: u32 = 31; +//static SEED: u32 = 31; #[derive(Clone)] pub struct MemphisStation { @@ -102,9 +99,10 @@ impl MemphisStation { format!("{}.final", self.get_internal_name(partition)) } - pub(crate) fn get_partition_key(&self, key: &str, partition_count: u32) -> u32 { - murmur3_32(&mut Cursor::new(key), SEED).unwrap_or(0) % partition_count - } + //TODO: Implement this once the other parts are implemented. + // pub(crate) fn get_partition_key(&self, key: &str, partition_count: u32) -> u32 { + // murmur3_32(&mut Cursor::new(key), SEED).unwrap_or(0) % partition_count + // } } #[cfg(feature = "consumers")] diff --git a/memphis/tests/consumer_tests.rs b/memphis/tests/consumer_tests.rs index 012b22f..2076b06 100644 --- a/memphis/tests/consumer_tests.rs +++ b/memphis/tests/consumer_tests.rs @@ -1,7 +1,7 @@ mod common; use common::*; -use memphis_rust_community::consumer::{MemphisConsumerOptions, MemphisEvent}; +use memphis_rust_community::consumer::MemphisConsumerOptions; use memphis_rust_community::producer::ComposableMessage; use std::time::Duration; use tokio_test::assert_ok; diff --git a/memphis/tests/message_tests.rs b/memphis/tests/message_tests.rs index c5c83e6..9e8c86d 100644 --- a/memphis/tests/message_tests.rs +++ b/memphis/tests/message_tests.rs @@ -1,4 +1,4 @@ -use memphis_rust_community::consumer::{MemphisConsumerOptions, MemphisEvent}; +use memphis_rust_community::consumer::MemphisConsumerOptions; use memphis_rust_community::producer::{ComposableMessage, MemphisProducerOptions}; use std::sync::Arc;