@@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
1818use tracing:: debug;
1919
2020use crate :: {
21- downloader:: { self , Downloader } ,
21+ downloader:: { self , ConcurrencyLimits , Downloader , RetryConfig } ,
2222 provider:: EventSender ,
2323 store:: GcConfig ,
2424 util:: {
@@ -147,7 +147,7 @@ impl BlobBatches {
147147pub struct Builder < S > {
148148 store : S ,
149149 events : Option < EventSender > ,
150- downloader : Option < crate :: downloader:: Config > ,
150+ downloader_config : Option < crate :: downloader:: Config > ,
151151 rt : Option < LocalPoolHandle > ,
152152}
153153
@@ -158,15 +158,29 @@ impl<S: crate::store::Store> Builder<S> {
158158 self
159159 }
160160
161- /// Set a custom `LocalPoolHandle` to use.
161+ /// Set a custom [ `LocalPoolHandle`] to use.
162162 pub fn local_pool ( mut self , rt : LocalPoolHandle ) -> Self {
163163 self . rt = Some ( rt) ;
164164 self
165165 }
166166
167- /// Set a custom downloader configuration.
168- pub fn downloader ( mut self , config : downloader:: Config ) -> Self {
169- self . downloader = Some ( config) ;
167+ /// Set custom downloader config
168+ pub fn downloader_config ( mut self , downloader_config : downloader:: Config ) -> Self {
169+ self . downloader_config = Some ( downloader_config) ;
170+ self
171+ }
172+
173+ /// Set custom [`ConcurrencyLimits`] to use.
174+ pub fn concurrency_limits ( mut self , concurrency_limits : ConcurrencyLimits ) -> Self {
175+ let downloader_config = self . downloader_config . get_or_insert_default ( ) ;
176+ downloader_config. concurrency = concurrency_limits;
177+ self
178+ }
179+
180+ /// Set a custom [`RetryConfig`] to use.
181+ pub fn retry_config ( mut self , retry_config : RetryConfig ) -> Self {
182+ let downloader_config = self . downloader_config . get_or_insert_default ( ) ;
183+ downloader_config. retry = retry_config;
170184 self
171185 }
172186
@@ -177,7 +191,7 @@ impl<S: crate::store::Store> Builder<S> {
177191 . rt
178192 . map ( Rt :: Handle )
179193 . unwrap_or_else ( || Rt :: Owned ( LocalPool :: default ( ) ) ) ;
180- let downloader_config = self . downloader . unwrap_or_default ( ) ;
194+ let downloader_config = self . downloader_config . unwrap_or_default ( ) ;
181195 let downloader = Downloader :: with_config (
182196 self . store . clone ( ) ,
183197 endpoint. clone ( ) ,
@@ -200,7 +214,7 @@ impl<S> Blobs<S> {
200214 Builder {
201215 store,
202216 events : None ,
203- downloader : None ,
217+ downloader_config : None ,
204218 rt : None ,
205219 }
206220 }
0 commit comments