@@ -3,6 +3,7 @@ use std::sync::Arc;
33
44use bytes:: Bytes ;
55use futures_util:: stream:: BoxStream ;
6+ use objectstore_types:: ExpirationPolicy ;
67use reqwest:: header:: HeaderName ;
78
89pub use objectstore_types:: { Compression , PARAM_SCOPE , PARAM_USECASE } ;
@@ -19,10 +20,11 @@ const USER_AGENT: &str = concat!("objectstore-client/", env!("CARGO_PKG_VERSION"
1920pub struct ClientBuilder {
2021 service_url : Arc < str > ,
2122 client : reqwest:: Client ,
23+ propagate_traces : bool ,
2224
2325 usecase : Arc < str > ,
2426 default_compression : Compression ,
25- propagate_traces : bool ,
27+ default_expiration_policy : ExpirationPolicy ,
2628}
2729
2830impl ClientBuilder {
@@ -47,10 +49,11 @@ impl ClientBuilder {
4749 Ok ( Self {
4850 service_url : service_url. trim_end_matches ( '/' ) . into ( ) ,
4951 client,
52+ propagate_traces : false ,
5053
5154 usecase : usecase. into ( ) ,
5255 default_compression : Compression :: Zstd ,
53- propagate_traces : false ,
56+ default_expiration_policy : ExpirationPolicy :: Manual ,
5457 } )
5558 }
5659
@@ -60,6 +63,12 @@ impl ClientBuilder {
6063 self
6164 }
6265
66+ /// This sets a default expiration policy used for uploads.
67+ pub fn default_expiration_policy ( mut self , expiration_policy : ExpirationPolicy ) -> Self {
68+ self . default_expiration_policy = expiration_policy;
69+ self
70+ }
71+
6372 /// This changes whether the `sentry-trace` header will be sent to Objectstore
6473 /// to take advantage of Sentry's distributed tracing.
6574 pub fn with_distributed_tracing ( mut self , propagate_traces : bool ) -> Self {
@@ -71,11 +80,12 @@ impl ClientBuilder {
7180 Client {
7281 service_url : self . service_url . clone ( ) ,
7382 http : self . client . clone ( ) ,
83+ propagate_traces : self . propagate_traces ,
7484
7585 usecase : self . usecase . clone ( ) ,
7686 scope,
7787 default_compression : self . default_compression ,
78- propagate_traces : self . propagate_traces ,
88+ default_expiration_policy : self . default_expiration_policy ,
7989 }
8090 }
8191
@@ -98,6 +108,7 @@ impl ClientBuilder {
98108pub struct Client {
99109 pub ( crate ) http : reqwest:: Client ,
100110 pub ( crate ) service_url : Arc < str > ,
111+ propagate_traces : bool ,
101112
102113 pub ( crate ) usecase : Arc < str > ,
103114
@@ -113,8 +124,7 @@ pub struct Client {
113124 /// characters.
114125 pub ( crate ) scope : String ,
115126 pub ( crate ) default_compression : Compression ,
116-
117- propagate_traces : bool ,
127+ pub ( crate ) default_expiration_policy : ExpirationPolicy ,
118128}
119129
120130/// The type of [`Stream`](futures_util::Stream) to be used for a PUT request.
0 commit comments