@@ -163,16 +163,16 @@ impl CacheByRecordType{
163
163
/// For each type of cache data, it removes the cache data that has expired, using
164
164
/// the `timeout_rr_cache` method of the `CacheByDomainName` struct. If the `CacheByDomainName` struct
165
165
/// is empty after the removal, it is removed from the cache data.
166
- pub fn filter_timeout_cache_data ( & mut self ) {
166
+ pub fn filter_timeout_by_rtype ( & mut self ) {
167
167
let cache_data = self . get_cache_data ( ) ;
168
168
let clean_cache_data: HashMap < Rtype , CacheByDomainName > = cache_data
169
169
. into_iter ( )
170
- . filter_map ( |( rtype, mut host_data ) | {
171
- host_data . filter_timeout_by_domain_name ( ) ;
172
- if host_data . get_domain_names_data ( ) . is_empty ( ) {
170
+ . filter_map ( |( rtype, mut data_by_domain ) | {
171
+ data_by_domain . filter_timeout_by_domain_name ( ) ;
172
+ if data_by_domain . get_domain_names_data ( ) . is_empty ( ) {
173
173
None
174
174
} else {
175
- Some ( ( rtype, host_data ) )
175
+ Some ( ( rtype, data_by_domain ) )
176
176
}
177
177
} )
178
178
. collect ( ) ;
@@ -447,7 +447,7 @@ mod cache_data_test{
447
447
}
448
448
449
449
#[ test]
450
- fn filter_timeout_cache_data_rtype_a ( ) {
450
+ fn filter_timeout_by_rtype_rtype_a ( ) {
451
451
use std:: { thread, time} ;
452
452
let mut cache_record_type = CacheByRecordType :: new ( ) ;
453
453
let a_rdata = Rdata :: A ( ARdata :: new ( ) ) ;
@@ -474,7 +474,7 @@ mod cache_data_test{
474
474
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
475
475
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
476
476
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
477
- cache_record_type. filter_timeout_cache_data ( ) ;
477
+ cache_record_type. filter_timeout_by_rtype ( ) ;
478
478
479
479
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
480
480
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: A ) {
@@ -489,7 +489,7 @@ mod cache_data_test{
489
489
}
490
490
491
491
#[ test]
492
- fn filter_timeout_cache_data_rtype_ns ( ) {
492
+ fn filter_timeout_by_rtype_rtype_ns ( ) {
493
493
use std:: { thread, time} ;
494
494
let mut cache_record_type = CacheByRecordType :: new ( ) ;
495
495
let ns_rdata = Rdata :: NS ( NsRdata :: new ( ) ) ;
@@ -516,7 +516,7 @@ mod cache_data_test{
516
516
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
517
517
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
518
518
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
519
- cache_record_type. filter_timeout_cache_data ( ) ;
519
+ cache_record_type. filter_timeout_by_rtype ( ) ;
520
520
521
521
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
522
522
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: NS ) {
@@ -531,7 +531,7 @@ mod cache_data_test{
531
531
}
532
532
533
533
#[ test]
534
- fn filter_timeout_cache_data_rtype_cname ( ) {
534
+ fn filter_timeout_by_rtype_rtype_cname ( ) {
535
535
use std:: { thread, time} ;
536
536
let mut cache_record_type = CacheByRecordType :: new ( ) ;
537
537
let cname_rdata = Rdata :: CNAME ( CnameRdata :: new ( ) ) ;
@@ -558,7 +558,7 @@ mod cache_data_test{
558
558
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
559
559
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
560
560
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
561
- cache_record_type. filter_timeout_cache_data ( ) ;
561
+ cache_record_type. filter_timeout_by_rtype ( ) ;
562
562
563
563
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
564
564
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: CNAME ) {
@@ -573,7 +573,7 @@ mod cache_data_test{
573
573
}
574
574
575
575
#[ test]
576
- fn filter_timeout_cache_data_rtype_soa ( ) {
576
+ fn filter_timeout_by_rtype_rtype_soa ( ) {
577
577
use std:: { thread, time} ;
578
578
let mut cache_record_type = CacheByRecordType :: new ( ) ;
579
579
let soa_rdata = Rdata :: SOA ( SoaRdata :: new ( ) ) ;
@@ -600,7 +600,7 @@ mod cache_data_test{
600
600
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
601
601
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
602
602
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
603
- cache_record_type. filter_timeout_cache_data ( ) ;
603
+ cache_record_type. filter_timeout_by_rtype ( ) ;
604
604
605
605
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
606
606
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: SOA ) {
@@ -615,7 +615,7 @@ mod cache_data_test{
615
615
}
616
616
617
617
#[ test]
618
- fn filter_timeout_cache_data_rtype_ptr ( ) {
618
+ fn filter_timeout_by_rtype_rtype_ptr ( ) {
619
619
use std:: { thread, time} ;
620
620
let mut cache_record_type = CacheByRecordType :: new ( ) ;
621
621
let ptr_rdata = Rdata :: PTR ( PtrRdata :: new ( ) ) ;
@@ -642,7 +642,7 @@ mod cache_data_test{
642
642
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
643
643
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
644
644
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
645
- cache_record_type. filter_timeout_cache_data ( ) ;
645
+ cache_record_type. filter_timeout_by_rtype ( ) ;
646
646
647
647
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
648
648
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: PTR ) {
@@ -657,7 +657,7 @@ mod cache_data_test{
657
657
}
658
658
659
659
#[ test]
660
- fn filter_timeout_cache_data_rtype_mx ( ) {
660
+ fn filter_timeout_by_rtype_rtype_mx ( ) {
661
661
use std:: { thread, time} ;
662
662
let mut cache_record_type = CacheByRecordType :: new ( ) ;
663
663
let mx_rdata = Rdata :: MX ( MxRdata :: new ( ) ) ;
@@ -684,7 +684,7 @@ mod cache_data_test{
684
684
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
685
685
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
686
686
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
687
- cache_record_type. filter_timeout_cache_data ( ) ;
687
+ cache_record_type. filter_timeout_by_rtype ( ) ;
688
688
689
689
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
690
690
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: MX ) {
@@ -699,7 +699,7 @@ mod cache_data_test{
699
699
}
700
700
701
701
#[ test]
702
- fn filter_timeout_cache_data_rtype_txt ( ) {
702
+ fn filter_timeout_by_rtype_rtype_txt ( ) {
703
703
use std:: { thread, time} ;
704
704
let mut cache_record_type = CacheByRecordType :: new ( ) ;
705
705
let txt_rdata = Rdata :: TXT ( TxtRdata :: new ( vec ! [ String :: from( "test" ) ] ) ) ;
@@ -726,7 +726,7 @@ mod cache_data_test{
726
726
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
727
727
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
728
728
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
729
- cache_record_type. filter_timeout_cache_data ( ) ;
729
+ cache_record_type. filter_timeout_by_rtype ( ) ;
730
730
731
731
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
732
732
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: TXT ) {
@@ -741,7 +741,7 @@ mod cache_data_test{
741
741
}
742
742
743
743
#[ test]
744
- fn filter_timeout_cache_data_rtype_hinfo ( ) {
744
+ fn filter_timeout_by_rtype_rtype_hinfo ( ) {
745
745
use std:: { thread, time} ;
746
746
let mut cache_record_type = CacheByRecordType :: new ( ) ;
747
747
let hinfo_rdata = Rdata :: HINFO ( HinfoRdata :: new ( ) ) ;
@@ -768,7 +768,7 @@ mod cache_data_test{
768
768
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
769
769
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
770
770
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
771
- cache_record_type. filter_timeout_cache_data ( ) ;
771
+ cache_record_type. filter_timeout_by_rtype ( ) ;
772
772
773
773
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
774
774
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: HINFO ) {
@@ -784,7 +784,7 @@ mod cache_data_test{
784
784
785
785
786
786
#[ test]
787
- fn filter_timeout_cache_data_rtype_tsig ( ) {
787
+ fn filter_timeout_by_rtype_rtype_tsig ( ) {
788
788
use std:: { thread, time} ;
789
789
let mut cache_record_type = CacheByRecordType :: new ( ) ;
790
790
let tsig_rdata = Rdata :: TSIG ( TSigRdata :: new ( ) ) ;
@@ -811,7 +811,7 @@ mod cache_data_test{
811
811
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
812
812
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
813
813
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
814
- cache_record_type. filter_timeout_cache_data ( ) ;
814
+ cache_record_type. filter_timeout_by_rtype ( ) ;
815
815
816
816
//check if the len is 1 instead of 2 (one RRStoredData was eliminated)
817
817
if let Some ( rr_cache_vec) = cache_record_type. get_from_cache_data ( domain_name. clone ( ) , Rtype :: TSIG ) {
@@ -864,7 +864,7 @@ mod cache_data_test{
864
864
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
865
865
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
866
866
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
867
- cache_record_type. filter_timeout_cache_data ( ) ;
867
+ cache_record_type. filter_timeout_by_rtype ( ) ;
868
868
869
869
let record_types_data_after_clean = cache_record_type. get_cache_data ( ) ;
870
870
@@ -927,7 +927,7 @@ mod cache_data_test{
927
927
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
928
928
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
929
929
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
930
- cache_record_type. filter_timeout_cache_data ( ) ;
930
+ cache_record_type. filter_timeout_by_rtype ( ) ;
931
931
932
932
let record_types_data_after_cleaning = cache_record_type. get_cache_data ( ) ;
933
933
@@ -1007,7 +1007,7 @@ mod cache_data_test{
1007
1007
println ! ( "Before timeout: {:?}" , Utc :: now( ) ) ;
1008
1008
thread:: sleep ( time:: Duration :: from_secs ( 5 ) ) ;
1009
1009
println ! ( "After timeout: {:?}" , Utc :: now( ) ) ;
1010
- cache_record_type. filter_timeout_cache_data ( ) ;
1010
+ cache_record_type. filter_timeout_by_rtype ( ) ;
1011
1011
1012
1012
let record_types_data_after_cleaning = cache_record_type. get_cache_data ( ) ;
1013
1013
0 commit comments