Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ travis-ci = { repository = "nlopes/libhoney-rust", branch = "master" }

[dependencies]
chrono = { version = "0.4", features = ["serde"] }
crossbeam-channel = "0.5"
log = "0.4"
parking_lot = "0.11"
rand = "0.8"
reqwest = { version = "0.11.0", features = ["blocking", "json"], default-features = false }
serde = { version = "1.0.118", features = ["derive"] }
Expand Down
7 changes: 0 additions & 7 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
*/
use std::collections::HashMap;

use crossbeam_channel::Receiver;
use log::info;
use serde_json::Value;

use crate::errors::Result;
use crate::fields::FieldHolder;
use crate::response::Response;
use crate::sender::Sender;
use crate::Event;
use crate::{Builder, DynamicFieldFunc};
Expand Down Expand Up @@ -143,11 +141,6 @@ where
pub fn new_event(&self) -> Event {
self.builder.new_event()
}

/// responses returns a receiver channel with responses
pub fn responses(&self) -> Receiver<Response> {
self.transmission.responses()
}
}

#[cfg(test)]
Expand Down
14 changes: 0 additions & 14 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ impl Error {
}
}

#[doc(hidden)]
pub(crate) fn sender_full(sender: &str) -> Self {
Self {
message: format!("sender '{}' is full", sender),
kind: ErrorKind::ChannelError,
}
}

#[doc(hidden)]
pub(crate) fn with_description(description: &str, kind: ErrorKind) -> Self {
Self {
Expand All @@ -83,9 +75,3 @@ impl From<io::Error> for Error {
Self::with_description(&e.to_string(), ErrorKind::Io)
}
}

impl<T> From<crossbeam_channel::SendError<T>> for Error {
fn from(e: crossbeam_channel::SendError<T>) -> Self {
Self::with_description(&e.to_string(), ErrorKind::ChannelError)
}
}
14 changes: 1 addition & 13 deletions src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/*!
Mock module to ease testing
*/
use crossbeam_channel::{bounded, Receiver};

use crate::response::Response;
use crate::sender::Sender;
use crate::transmission::Options;
use crate::Event;
Expand All @@ -16,7 +14,6 @@ pub struct TransmissionMock {
stopped: usize,
events_called: usize,
events: Vec<Event>,
responses: Receiver<Response>,
block_on_responses: bool,
}

Expand All @@ -37,25 +34,16 @@ impl Sender for TransmissionMock {
self.stopped += 1;
Ok(())
}

// `responses` returns a channel that will contain a single Response for each
// Event added. Note that they may not be in the same order as they came in
fn responses(&self) -> Receiver<Response> {
self.responses.clone()
}
}

impl TransmissionMock {
pub(crate) fn new(options: Options) -> Result<Self> {
let (_, responses) = bounded(options.pending_work_capacity * 4);

pub(crate) fn new(_options: Options) -> Result<Self> {
Ok(Self {
started: 0,
stopped: 0,
events_called: 0,
events: Vec::new(),
block_on_responses: false,
responses,
})
}

Expand Down
7 changes: 0 additions & 7 deletions src/sender.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use crossbeam_channel::Receiver;

use crate::errors::Result;
use crate::response::Response;
use crate::Event;

/// `Sender` is responsible for handling events after Send() is called. Implementations
Expand All @@ -16,8 +13,4 @@ pub trait Sender {
/// `stop` flushes any pending queues and blocks until everything in flight has been
/// sent
fn stop(&mut self) -> Result<()>;

/// `responses` returns a channel that will contain a single Response for each Event
/// added. Note that they may not be in the same order as they came in
fn responses(&self) -> Receiver<Response>;
}
Loading