Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Move all backoff in one mod #103

Merged
merged 1 commit into from
Aug 23, 2024
Merged
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
File renamed without changes.
4 changes: 2 additions & 2 deletions src/constant.rs → src/backoff/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ mod tests {
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as test;

use crate::backoff::BackoffBuilder;
use crate::constant::ConstantBuilder;
use crate::BackoffBuilder;
use crate::ConstantBuilder;

#[test]
fn test_constant_default() {
Expand Down
4 changes: 2 additions & 2 deletions src/exponential.rs → src/backoff/exponential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ mod tests {
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as test;

use crate::backoff::BackoffBuilder;
use crate::exponential::ExponentialBuilder;
use crate::BackoffBuilder;
use crate::ExponentialBuilder;

#[test]
fn test_exponential_default() {
Expand Down
4 changes: 2 additions & 2 deletions src/fibonacci.rs → src/backoff/fibonacci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ mod tests {
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as test;

use crate::backoff::BackoffBuilder;
use crate::fibonacci::FibonacciBuilder;
use crate::BackoffBuilder;
use crate::FibonacciBuilder;

#[test]
fn test_fibonacci_default() {
Expand Down
14 changes: 14 additions & 0 deletions src/backoff/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
mod api;
pub use api::*;

mod constant;
pub use constant::ConstantBackoff;
pub use constant::ConstantBuilder;

mod fibonacci;
pub use fibonacci::FibonacciBackoff;
pub use fibonacci::FibonacciBuilder;

mod exponential;
pub use exponential::ExponentialBackoff;
pub use exponential::ExponentialBuilder;
2 changes: 1 addition & 1 deletion src/blocking_retry_with_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ mod tests {
use std::sync::Mutex;

use super::*;
use crate::exponential::ExponentialBuilder;
use crate::ExponentialBuilder;
use anyhow::Result;

struct Test;
Expand Down
15 changes: 1 addition & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,7 @@
#![deny(unused_qualifications)]

mod backoff;
pub use backoff::Backoff;
pub use backoff::BackoffBuilder;

mod constant;
pub use constant::ConstantBackoff;
pub use constant::ConstantBuilder;

mod exponential;
pub use exponential::ExponentialBackoff;
pub use exponential::ExponentialBuilder;

mod fibonacci;
pub use fibonacci::FibonacciBackoff;
pub use fibonacci::FibonacciBuilder;
pub use backoff::*;

mod retry;
pub use retry::Retry;
Expand Down
2 changes: 1 addition & 1 deletion src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ mod tests {
use tokio::test;

use super::*;
use crate::exponential::ExponentialBuilder;
use crate::ExponentialBuilder;

async fn always_error() -> anyhow::Result<()> {
Err(anyhow::anyhow!("test_query meets error"))
Expand Down
2 changes: 1 addition & 1 deletion src/retry_with_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ mod tests {
use tokio::test;

use super::*;
use crate::exponential::ExponentialBuilder;
use crate::ExponentialBuilder;

struct Test;

Expand Down