Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
avdb13 committed Nov 15, 2024
1 parent c6d51fe commit c755e59
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 73 deletions.
8 changes: 1 addition & 7 deletions atrium-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ documentation = "https://docs.rs/atrium-common"
readme = "README.md"
repository.workspace = true
license.workspace = true
keywords = ["atproto", "bluesky", "identity"]
keywords = ["atproto", "bluesky"]

[dependencies]
atrium-xrpc.workspace = true
chrono = { workspace = true, features = ["serde"] }
dashmap.workspace = true
hickory-proto = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }
serde_html_form.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio = { workspace = true, default-features = false, features = ["sync"] }
trait-variant.workspace = true
Expand Down
3 changes: 1 addition & 2 deletions atrium-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod types;

pub mod resolver;
pub mod store;
pub mod types;
7 changes: 5 additions & 2 deletions atrium-common/src/resolver.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
mod cached;
mod error;
mod throttled;

pub use self::cached::CachedResolver;
pub use self::error::{Error, Result};
pub use self::throttled::ThrottledResolver;
use std::future::Future;

Expand Down Expand Up @@ -42,6 +40,11 @@ mod tests {
gloo_timers::future::sleep(duration).await;
}

#[derive(Debug)]
struct Error;

type Result<T> = core::result::Result<T, Error>;

struct MockResolver {
data: HashMap<String, String>,
counts: Arc<RwLock<HashMap<String, usize>>>,
Expand Down
25 changes: 0 additions & 25 deletions atrium-common/src/resolver/error.rs

This file was deleted.

20 changes: 0 additions & 20 deletions atrium-oauth/identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,13 @@ keywords = ["atproto", "bluesky", "identity"]
atrium-api = { workspace = true, default-features = false }
atrium-common.workspace = true
atrium-xrpc.workspace = true
dashmap.workspace = true
hickory-proto = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }
serde_html_form.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio = { workspace = true, default-features = false, features = ["sync"] }
trait-variant.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
moka = { workspace = true, features = ["future"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
lru.workspace = true
web-time.workspace = true

[dev-dependencies]
futures.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
gloo-timers.workspace = true
tokio = { workspace = true, features = ["time"] }
wasm-bindgen-test.workspace = true

[features]
default = []
doh-handle-resolver = ["dep:hickory-proto"]
16 changes: 0 additions & 16 deletions atrium-oauth/identity/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use atrium_api::types::string::Did;
use atrium_common::resolver;
use atrium_xrpc::http::uri::InvalidUri;
use atrium_xrpc::http::StatusCode;
use thiserror::Error;
Expand Down Expand Up @@ -36,19 +35,4 @@ pub enum Error {
Uri(#[from] InvalidUri),
}

impl From<resolver::Error> for Error {
fn from(error: resolver::Error) -> Self {
match error {
resolver::Error::DnsResolver(error) => Error::DnsResolver(error),
resolver::Error::Http(error) => Error::Http(error),
resolver::Error::HttpClient(error) => Error::HttpClient(error),
resolver::Error::HttpStatus(error) => Error::HttpStatus(error),
resolver::Error::SerdeJson(error) => Error::SerdeJson(error),
resolver::Error::SerdeHtmlForm(error) => Error::SerdeHtmlForm(error),
resolver::Error::Uri(error) => Error::Uri(error),
resolver::Error::NotFound => Error::NotFound,
}
}
}

pub type Result<T> = core::result::Result<T, Error>;
1 change: 0 additions & 1 deletion atrium-oauth/identity/src/identity_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ impl<D, H> Resolver for IdentityResolver<D, H>
where
D: DidResolver + Send + Sync + 'static,
H: HandleResolver + Send + Sync + 'static,
// Error: From<D::Error> + From<H::Error>,
{
type Input = str;
type Output = ResolvedIdentity;
Expand Down

0 comments on commit c755e59

Please sign in to comment.