Skip to content

Commit de62d46

Browse files
zeevmrtyler
authored andcommitted
Gate RetryConfig on 'cloud' feature
Signed-off-by: Ze'ev Maor <[email protected]>
1 parent 0f9c203 commit de62d46

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

crates/core/src/logstore/config.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//!
77
//! Specific pieces of configuration must implement the `TryUpdateKey` trait which
88
//! defines how to update internal fields based on key-value pairs.
9-
use std::collections::HashMap;
10-
9+
#[cfg(feature = "cloud")]
1110
use ::object_store::RetryConfig;
1211
use object_store::{path::Path, prefix::PrefixStore, ObjectStore};
12+
use std::collections::HashMap;
1313

1414
use super::storage::LimitConfig;
1515
use super::{storage::runtime::RuntimeConfig, IORuntime};
@@ -95,6 +95,7 @@ pub struct StorageConfig {
9595
/// dedicated handle.
9696
pub runtime: Option<IORuntime>,
9797

98+
#[cfg(feature = "cloud")]
9899
pub retry: ::object_store::RetryConfig,
99100

100101
/// Limit configuration.
@@ -166,6 +167,7 @@ where
166167

167168
let remainder = result.unparsed;
168169

170+
#[cfg(feature = "cloud")]
169171
let remainder = {
170172
let result = ParseResult::<RetryConfig>::from_iter(remainder);
171173
config.retry = result.config;
@@ -216,6 +218,7 @@ impl StorageConfig {
216218
props.limit = (!result.is_default).then_some(result.config);
217219
let remainder = result.unparsed;
218220

221+
#[cfg(feature = "cloud")]
219222
let remainder = {
220223
let (retry, remainder): (RetryConfig, _) = try_parse_impl(remainder)?;
221224
props.retry = retry;

crates/core/src/logstore/factories.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::{
44
};
55

66
use dashmap::DashMap;
7+
#[cfg(feature = "cloud")]
78
use object_store::RetryConfig;
89
use object_store::{path::Path, DynObjectStore};
910
use tokio::runtime::Handle;
@@ -25,13 +26,22 @@ pub trait ObjectStoreFactory: Send + Sync {
2526
/// corresponding to the path segment of the URL.
2627
///
2728
/// The store should __NOT__ apply the decorations via the passed `options`
29+
#[cfg(feature = "cloud")]
2830
fn parse_url_opts(
2931
&self,
3032
url: &Url,
3133
options: &HashMap<String, String>,
3234
retry: &RetryConfig,
3335
handle: Option<Handle>,
3436
) -> DeltaResult<(ObjectStoreRef, Path)>;
37+
38+
#[cfg(not(feature = "cloud"))]
39+
fn parse_url_opts(
40+
&self,
41+
url: &Url,
42+
options: &HashMap<String, String>,
43+
handle: Option<Handle>,
44+
) -> DeltaResult<(ObjectStoreRef, Path)>;
3545
}
3646

3747
#[derive(Clone, Debug, Default)]
@@ -42,7 +52,7 @@ impl ObjectStoreFactory for DefaultObjectStoreFactory {
4252
&self,
4353
url: &Url,
4454
options: &HashMap<String, String>,
45-
_retry: &RetryConfig,
55+
#[cfg(feature = "cloud")] _retry: &RetryConfig,
4656
handle: Option<Handle>,
4757
) -> DeltaResult<(ObjectStoreRef, Path)> {
4858
let (mut store, path) = default_parse_url_opts(url, options)?;
@@ -92,8 +102,11 @@ where
92102
let scheme = Url::parse(&format!("{}://", url.scheme())).unwrap();
93103
let storage_config = StorageConfig::parse_options(options)?;
94104
if let Some(factory) = object_store_factories().get(&scheme) {
105+
#[cfg(feature = "cloud")]
95106
let (store, _prefix) =
96107
factory.parse_url_opts(url, &storage_config.raw, &storage_config.retry, None)?;
108+
#[cfg(not(feature = "cloud"))]
109+
let (store, _prefix) = factory.parse_url_opts(url, &storage_config.raw, None)?;
97110
let store = storage_config.decorate_store(store, url)?;
98111
Ok(Arc::new(store))
99112
} else {

crates/core/src/logstore/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ pub fn logstore_for(location: Url, storage_config: StorageConfig) -> DeltaResult
183183
let (root_store, _prefix) = entry.value().parse_url_opts(
184184
&location,
185185
&storage_config.raw,
186+
#[cfg(feature = "cloud")]
186187
&storage_config.retry,
187188
storage_config.runtime.clone().map(|rt| rt.get_handle()),
188189
)?;

crates/core/src/logstore/storage/retry_ext.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ pub trait ObjectStoreRetryExt: ObjectStore {
7777
}
7878
}
7979

80+
#[cfg(feature = "cloud")]
8081
impl config::TryUpdateKey for object_store::RetryConfig {
8182
fn try_update_key(&mut self, key: &str, v: &str) -> crate::DeltaResult<Option<()>> {
8283
match key {

0 commit comments

Comments
 (0)