@@ -279,7 +279,7 @@ impl private::Sealed for ObjectStorage {}
279279#[ typetag:: serde]
280280impl Storage for ObjectStorage {
281281 fn can_write ( & self ) -> bool {
282- true
282+ self . backend . can_write ( )
283283 }
284284
285285 #[ instrument( skip_all) ]
@@ -654,6 +654,10 @@ pub trait ObjectStoreBackend: Debug + Display + Sync + Send {
654654 }
655655
656656 fn default_settings ( & self ) -> Settings ;
657+
658+ fn can_write ( & self ) -> bool {
659+ true
660+ }
657661}
658662
659663#[ derive( Debug , Serialize , Deserialize ) ]
@@ -785,7 +789,7 @@ impl fmt::Display for HttpObjectStoreBackend {
785789impl ObjectStoreBackend for HttpObjectStoreBackend {
786790 fn mk_object_store (
787791 & self ,
788- _settings : & Settings ,
792+ settings : & Settings ,
789793 ) -> Result < Arc < dyn ObjectStore > , StorageError > {
790794 let builder = HttpBuilder :: new ( ) . with_url ( & self . url ) ;
791795
@@ -797,6 +801,20 @@ impl ObjectStoreBackend for HttpObjectStoreBackend {
797801 . iter ( )
798802 . fold ( builder, |builder, ( key, value) | builder. with_config ( * key, value) ) ;
799803
804+ let builder = builder. with_retry ( RetryConfig {
805+ backoff : BackoffConfig {
806+ init_backoff : core:: time:: Duration :: from_millis (
807+ settings. retries ( ) . initial_backoff_ms ( ) as u64 ,
808+ ) ,
809+ max_backoff : core:: time:: Duration :: from_millis (
810+ settings. retries ( ) . max_backoff_ms ( ) as u64 ,
811+ ) ,
812+ base : 2. ,
813+ } ,
814+ max_retries : settings. retries ( ) . max_tries ( ) . get ( ) as usize - 1 ,
815+ retry_timeout : core:: time:: Duration :: from_secs ( 5 * 60 ) ,
816+ } ) ;
817+
800818 let store =
801819 builder. build ( ) . map_err ( |e| StorageErrorKind :: Other ( e. to_string ( ) ) ) ?;
802820
@@ -810,6 +828,11 @@ impl ObjectStoreBackend for HttpObjectStoreBackend {
810828 fn default_settings ( & self ) -> Settings {
811829 Default :: default ( )
812830 }
831+
832+ fn can_write ( & self ) -> bool {
833+ // TODO: Support write operations?
834+ false
835+ }
813836}
814837
815838#[ derive( Debug , Serialize , Deserialize ) ]
0 commit comments