Skip to content

Commit

Permalink
removing unused types
Browse files Browse the repository at this point in the history
  • Loading branch information
minghuaw committed Apr 18, 2023
1 parent 3d53a59 commit 90f6d48
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 109 deletions.
1 change: 1 addition & 0 deletions sdk/messaging_eventhubs/src/amqp/amqp_connection_scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub(crate) struct AmqpConnectionScope {
impl AmqpConnectionScope {
const CONNECTION_IDLE_TIMEOUT: StdDuration = StdDuration::from_secs(60);
const AUTHORIZATION_REFRESH_TIMEOUT: StdDuration = StdDuration::from_secs(60 * 7);

/// The amount of buffer to apply when considering an authorization token
/// to be expired. The token's actual expiration will be decreased by this
/// amount, ensuring that it is renewed before it has expired.
Expand Down
29 changes: 3 additions & 26 deletions sdk/messaging_eventhubs/src/amqp/amqp_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,6 @@ impl<RP> AmqpProducer<RP> {
Ok(AmqpEventBatch::new(max_size_in_bytes, options))
}

// async fn send(
// &mut self,
// events: impl Iterator<Item = Event> + ExactSizeIterator + Send,
// options: SendEventOptions,
// ) -> Result<(), AmqpSendError> {
// // TODO: check size of envelope and make sure it's not too big
// match create_envelope_from_events(events, options.partition_key) {
// Some(mut batch) => self.send_batch_envelope(&mut batch).await,
// None => Ok(()),
// }
// }

// async fn send_batch(
// &mut self,
// batch: AmqpEventBatch,
// options: SendEventOptions,
// ) -> Result<(), AmqpSendError> {
// match build_amqp_batch_from_messages(batch.events.into_iter(), options.partition_key) {
// Some(mut batch) => self.send_batch_envelope(&mut batch).await,
// None => Ok(()),
// }
// }

pub(crate) async fn close(mut self) -> Result<(), DisposeProducerError> {
// There is no need to remove the refresher if CBS link is already stopped
let _ = self
Expand Down Expand Up @@ -273,7 +250,7 @@ where
}
}

fn read_initialization_publishing_properties(&self) -> &PartitionPublishingProperties {
&self.producer.initialized_partition_properties
}
// fn read_initialization_publishing_properties(&self) -> &PartitionPublishingProperties {
// &self.producer.initialized_partition_properties
// }
}
8 changes: 2 additions & 6 deletions sdk/messaging_eventhubs/src/core/transport_producer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use async_trait::async_trait;

use crate::{
producer::{
create_batch_options::CreateBatchOptions,
partition_publishing_properties::PartitionPublishingProperties,
send_event_options::SendEventOptions,
},
producer::{create_batch_options::CreateBatchOptions, send_event_options::SendEventOptions},
Event,
};

Expand Down Expand Up @@ -35,5 +31,5 @@ pub trait TransportProducer {
options: SendEventOptions,
) -> Result<(), Self::SendError>;

fn read_initialization_publishing_properties(&self) -> &PartitionPublishingProperties;
// fn read_initialization_publishing_properties(&self) -> &PartitionPublishingProperties;
}
27 changes: 14 additions & 13 deletions sdk/messaging_eventhubs/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@ use crate::amqp::{
};
use crate::constants::DEFAULT_OFFSET_DATE_TIME;

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub(crate) enum PublishSequenceNumber {
Pending {
value: i32,
producer_group_id: i64,
owner_level: i16,
},
Published {
value: i32,
},
}
// /// TODO: This is not being used because `send_idempotent` is not implemented yet.
// #[derive(Debug, Clone, PartialEq, Eq, Hash)]
// pub(crate) enum PublishSequenceNumber {
// Pending {
// value: i32,
// producer_group_id: i64,
// owner_level: i16,
// },
// Published {
// value: i32,
// },
// }

/// An Event Hubs event, encapsulating a set of data and its associated metadata.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Event {
pub(crate) amqp_message: Message<Data>,
pub(crate) sequence_number: Option<PublishSequenceNumber>,
// /// TODO: This is not being used because `send_idempotent` is not implemented yet.
// pub(crate) sequence_number: Option<PublishSequenceNumber>,
}

impl<T> From<T> for Event
Expand All @@ -41,7 +43,6 @@ where
fn from(value: T) -> Self {
Self {
amqp_message: Message::builder().data(Binary::from(value)).build(),
sequence_number: None,
}
}
}
Expand Down
55 changes: 0 additions & 55 deletions sdk/messaging_eventhubs/src/producer/error.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ use super::{

pub const MINIMUM_BATCH_SIZE_LIMIT: usize = 24;

fn next_sequence_number(current: i32) -> i32 {
let next = current.wrapping_add(1);
match next < 0 {
true => 0,
false => next,
}
}

pub struct EventHubProducerClient<RP> {
connection: EventHubConnection<AmqpClient>,
/// An abstracted Event Hub transport-specific producer that is associated with the
Expand Down
1 change: 0 additions & 1 deletion sdk/messaging_eventhubs/src/producer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Producer client

pub mod create_batch_options;
pub mod error;
pub mod event_batch;
pub mod event_hub_producer_client;
pub mod event_hub_producer_client_options;
Expand Down

0 comments on commit 90f6d48

Please sign in to comment.