@@ -589,7 +589,7 @@ pub async fn get_stream_info(stream_name: Path<String>) -> Result<impl Responder
589
589
590
590
pub async fn put_stream_hot_tier (
591
591
stream_name : Path < String > ,
592
- Json ( json ) : Json < Value > ,
592
+ Json ( mut hottier ) : Json < StreamHotTier > ,
593
593
) -> Result < impl Responder , StreamError > {
594
594
let stream_name = stream_name. into_inner ( ) ;
595
595
if !STREAM_INFO . stream_exists ( & stream_name) {
@@ -616,11 +616,6 @@ pub async fn put_stream_hot_tier(
616
616
return Err ( StreamError :: HotTierNotEnabled ( stream_name) ) ;
617
617
}
618
618
619
- let mut hottier: StreamHotTier = match serde_json:: from_value ( json) {
620
- Ok ( hottier) => hottier,
621
- Err ( err) => return Err ( StreamError :: InvalidHotTierConfig ( err) ) ,
622
- } ;
623
-
624
619
validator:: hot_tier ( & hottier. size . to_string ( ) ) ?;
625
620
626
621
STREAM_INFO . set_hot_tier ( & stream_name, true ) ?;
@@ -836,8 +831,6 @@ pub mod error {
836
831
"Hot tier is not enabled at the server config, cannot enable hot tier for stream {0}"
837
832
) ]
838
833
HotTierNotEnabled ( String ) ,
839
- #[ error( "failed to enable hottier due to err: {0}" ) ]
840
- InvalidHotTierConfig ( serde_json:: Error ) ,
841
834
#[ error( "Hot tier validation failed: {0}" ) ]
842
835
HotTierValidation ( #[ from] HotTierValidationError ) ,
843
836
#[ error( "{0}" ) ]
@@ -875,7 +868,6 @@ pub mod error {
875
868
err. status ( ) . unwrap_or ( StatusCode :: INTERNAL_SERVER_ERROR )
876
869
}
877
870
StreamError :: HotTierNotEnabled ( _) => StatusCode :: BAD_REQUEST ,
878
- StreamError :: InvalidHotTierConfig ( _) => StatusCode :: BAD_REQUEST ,
879
871
StreamError :: HotTierValidation ( _) => StatusCode :: BAD_REQUEST ,
880
872
StreamError :: HotTierError ( _) => StatusCode :: INTERNAL_SERVER_ERROR ,
881
873
}
0 commit comments