Skip to content

Commit

Permalink
remove async from AuthorityObject where unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejekyll committed Sep 14, 2021
1 parent 819b5f3 commit 8e30471
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions crates/server/src/authority/authority_object.rs
Expand Up @@ -26,16 +26,16 @@ pub trait AuthorityObject: Send + Sync {
fn box_clone(&self) -> Box<dyn AuthorityObject>;

/// What type is this zone
async fn zone_type(&self) -> ZoneType;
fn zone_type(&self) -> ZoneType;

/// Return true if AXFR is allowed
async fn is_axfr_allowed(&self) -> bool;
fn is_axfr_allowed(&self) -> bool;

/// Perform a dynamic update of a zone
async fn update(&self, update: &MessageRequest) -> UpdateResult<bool>;

/// Get the origin of this zone, i.e. example.com is the origin for www.example.com
async fn origin(&self) -> LowerName;
fn origin(&self) -> &LowerName;

/// Looks up all Resource Records matching the giving `Name` and `RecordType`.
///
Expand Down Expand Up @@ -80,7 +80,7 @@ pub trait AuthorityObject: Send + Sync {
&self,
lookup_options: LookupOptions,
) -> Result<Box<dyn LookupObject>, LookupError> {
self.lookup(&self.origin().await, RecordType::NS, lookup_options)
self.lookup(self.origin(), RecordType::NS, lookup_options)
.await
}

Expand All @@ -103,20 +103,16 @@ pub trait AuthorityObject: Send + Sync {
/// should be used, see `soa_secure()`, which will optionally return RRSIGs.
async fn soa(&self) -> Result<Box<dyn LookupObject>, LookupError> {
// SOA should be origin|SOA
self.lookup(
&self.origin().await,
RecordType::SOA,
LookupOptions::default(),
)
.await
self.lookup(self.origin(), RecordType::SOA, LookupOptions::default())
.await
}

/// Returns the SOA record for the zone
async fn soa_secure(
&self,
lookup_options: LookupOptions,
) -> Result<Box<dyn LookupObject>, LookupError> {
self.lookup(&self.origin().await, RecordType::SOA, lookup_options)
self.lookup(self.origin(), RecordType::SOA, lookup_options)
.await
}
}
Expand All @@ -132,14 +128,12 @@ where
}

/// What type is this zone
// FIXME: does not need to be async
async fn zone_type(&self) -> ZoneType {
fn zone_type(&self) -> ZoneType {
Authority::zone_type(self.as_ref())
}

/// Return true if AXFR is allowed
// FIXME: does not need to be async
async fn is_axfr_allowed(&self) -> bool {
fn is_axfr_allowed(&self) -> bool {
Authority::is_axfr_allowed(self.as_ref())
}

Expand All @@ -149,9 +143,8 @@ where
}

/// Get the origin of this zone, i.e. example.com is the origin for www.example.com
// FIXME: does not need to be async
async fn origin(&self) -> LowerName {
Authority::origin(self.as_ref()).clone()
fn origin(&self) -> &LowerName {
Authority::origin(self.as_ref())
}

/// Looks up all Resource Records matching the giving `Name` and `RecordType`.
Expand Down

0 comments on commit 8e30471

Please sign in to comment.