Skip to content

Commit

Permalink
Fix Lint & Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
turulix committed Oct 10, 2023
1 parent c8812e9 commit f96ed65
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
4 changes: 0 additions & 4 deletions memphis/src/consumer/memphis_consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion memphis/src/memphis_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 6 additions & 8 deletions memphis/src/station/memphis_station.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion memphis/tests/consumer_tests.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion memphis/tests/message_tests.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit f96ed65

Please sign in to comment.