Skip to content

Commit

Permalink
chore: code fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ii64 committed Mar 9, 2025
1 parent 863bd49 commit d817632
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,6 @@ use volo::{
};
use volo_http::client::dns::DnsResolver;

#[derive(Clone)]
pub struct NoCacheDiscover<T>(T);

impl<T> NoCacheDiscover<T> {
pub fn new(inner: T) -> Self {
Self(inner)
}
}

impl<T> Discover for NoCacheDiscover<T>
where
T: Discover,
{
type Key = ();
type Error = T::Error;

async fn discover(&self, endpoint: &Endpoint) -> Result<Vec<Arc<Instance>>, Self::Error> {
self.0.discover(endpoint).await
}

fn key(&self, endpoint: &Endpoint) -> Self::Key {}

fn watch(
&self,
keys: Option<&[Self::Key]>,
) -> Option<Receiver<volo::discovery::Change<Self::Key>>> {
None
}
}

#[derive(Clone)]
pub struct ConstantDnsDiscover {
resolver: DnsResolver,
Expand All @@ -64,7 +34,7 @@ impl Discover for ConstantDnsDiscover {

async fn discover<'s>(
&'s self,
endpoint: &'s Endpoint,
_endpoint: &'s Endpoint,
) -> Result<Vec<Arc<Instance>>, Self::Error> {
let mut endpoint = Endpoint::new(self.service_name.clone().into());
let addr = self
Expand All @@ -78,11 +48,11 @@ impl Discover for ConstantDnsDiscover {
self.resolver.discover(&endpoint).await
}

fn key(&self, endpoint: &Endpoint) -> Self::Key {}
fn key(&self, _endpoint: &Endpoint) -> Self::Key {}

fn watch(
&self,
keys: Option<&[Self::Key]>,
_keys: Option<&[Self::Key]>,
) -> Option<Receiver<volo::discovery::Change<Self::Key>>> {
None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pub struct RpcProvider {
caller_name: String,
callee_name: String,

resolver: DnsResolver,
metadata: Option<MetadataMap>,
inner: Arc<RpcProviderInner>,
}
Expand All @@ -55,7 +54,6 @@ impl RpcProvider {
caller_name: "volo".into(),
callee_name: "app_gateway_service".into(),

resolver: DnsResolver::default(),
metadata: None,
inner: Arc::new(RpcProviderInner::new(tls_connector)),
}
Expand Down

0 comments on commit d817632

Please sign in to comment.