Skip to content

Commit

Permalink
ref(quotas): Split crate types into submodules (#600)
Browse files Browse the repository at this point in the history
Refactors `relay-quotas` without any functional changes and adds a few
tests.
  • Loading branch information
jan-auer authored Jun 3, 2020
1 parent 8e30d6a commit b64cfb2
Show file tree
Hide file tree
Showing 8 changed files with 849 additions and 748 deletions.
2 changes: 1 addition & 1 deletion relay-quotas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ publish = false

[features]
default = []
rate-limiter = [
redis = [
"failure",
"log",
"relay-redis/impl",
Expand Down
2 changes: 1 addition & 1 deletion relay-quotas/src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer};
use smallvec::smallvec;

use crate::types::{DataCategory, Quota, QuotaScope, ReasonCode};
use crate::quota::{DataCategory, Quota, QuotaScope, ReasonCode};

/// Legacy format of the `Quota` type.
#[derive(Deserialize, Serialize)]
Expand Down
19 changes: 13 additions & 6 deletions relay-quotas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
#![warn(missing_docs)]

mod types;
pub use self::types::*;
/// The default timeout to apply when a scope is fully rejected. This
/// typically happens for disabled keys, projects, or organizations.
const REJECT_ALL_SECS: u64 = 60;

mod quota;
mod rate_limit;

pub use self::quota::*;
pub use self::rate_limit::*;

#[cfg(feature = "legacy")]
pub mod legacy;

#[cfg(feature = "rate-limiter")]
mod rate_limiter;
#[cfg(feature = "rate-limiter")]
pub use self::rate_limiter::*;
#[cfg(feature = "redis")]
mod redis;
#[cfg(feature = "redis")]
pub use self::redis::*;
Loading

0 comments on commit b64cfb2

Please sign in to comment.