@@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
18
18
use tracing:: debug;
19
19
20
20
use crate :: {
21
- downloader:: { self , Downloader } ,
21
+ downloader:: { self , ConcurrencyLimits , Downloader , RetryConfig } ,
22
22
provider:: EventSender ,
23
23
store:: GcConfig ,
24
24
util:: {
@@ -147,7 +147,7 @@ impl BlobBatches {
147
147
pub struct Builder < S > {
148
148
store : S ,
149
149
events : Option < EventSender > ,
150
- downloader : Option < crate :: downloader:: Config > ,
150
+ downloader_config : Option < crate :: downloader:: Config > ,
151
151
rt : Option < LocalPoolHandle > ,
152
152
}
153
153
@@ -158,15 +158,29 @@ impl<S: crate::store::Store> Builder<S> {
158
158
self
159
159
}
160
160
161
- /// Set a custom `LocalPoolHandle` to use.
161
+ /// Set a custom [ `LocalPoolHandle`] to use.
162
162
pub fn local_pool ( mut self , rt : LocalPoolHandle ) -> Self {
163
163
self . rt = Some ( rt) ;
164
164
self
165
165
}
166
166
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;
170
184
self
171
185
}
172
186
@@ -177,7 +191,7 @@ impl<S: crate::store::Store> Builder<S> {
177
191
. rt
178
192
. map ( Rt :: Handle )
179
193
. 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 ( ) ;
181
195
let downloader = Downloader :: with_config (
182
196
self . store . clone ( ) ,
183
197
endpoint. clone ( ) ,
@@ -200,7 +214,7 @@ impl<S> Blobs<S> {
200
214
Builder {
201
215
store,
202
216
events : None ,
203
- downloader : None ,
217
+ downloader_config : None ,
204
218
rt : None ,
205
219
}
206
220
}
0 commit comments