Skip to content

Commit c1b0c88

Browse files
committed
Code review feedback
1 parent 243739f commit c1b0c88

2 files changed

Lines changed: 26 additions & 10 deletions

File tree

icechunk/src/storage/object_store.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl private::Sealed for ObjectStorage {}
279279
#[typetag::serde]
280280
impl 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 {
785789
impl 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)]

icechunk/src/virtual_chunks.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ impl VirtualChunkContainer {
6363
Err("in memory storage does not accept credentials".to_string())
6464
}
6565
(ObjectStoreConfig::Http(_), _) => {
66+
// TODO: Support basic and bearer auth
6667
Err("http storage does not support credentials".to_string())
6768
}
6869
(ObjectStoreConfig::S3Compatible(_), Credentials::S3(_)) => Ok(()),
@@ -137,14 +138,6 @@ pub fn mk_default_containers() -> HashMap<ContainerName, VirtualChunkContainer>
137138
store: ObjectStoreConfig::Http(HashMap::new()),
138139
},
139140
),
140-
(
141-
"https".to_string(),
142-
VirtualChunkContainer {
143-
name: "https".to_string(),
144-
url_prefix: "https".to_string(),
145-
store: ObjectStoreConfig::Http(HashMap::new()),
146-
},
147-
),
148141
]
149142
.into_iter()
150143
.collect()

0 commit comments

Comments
 (0)