Skip to content

Commit 4ecae74

Browse files
committed
remane to factory
1 parent 5cf42f6 commit 4ecae74

File tree

9 files changed

+133
-133
lines changed

9 files changed

+133
-133
lines changed

crates/iceberg/src/io/file_io.rs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use bytes::Bytes;
2626
use url::Url;
2727

2828
// Re-export traits from storage module
29-
pub use super::storage::{Storage, StorageBuilder, StorageBuilderRegistry};
29+
pub use super::storage::{Storage, StorageFactory, StorageRegistry};
3030
use crate::io::STORAGE_LOCATION_SCHEME;
3131
use crate::{Error, ErrorKind, Result};
3232

@@ -168,18 +168,18 @@ impl Extensions {
168168
/// # Custom Storage Implementations
169169
///
170170
/// You can use custom storage implementations by creating a custom
171-
/// [`StorageBuilderRegistry`] and registering your storage builder:
171+
/// [`StorageRegistry`] and registering your storage factory:
172172
///
173173
/// ```rust,ignore
174-
/// use iceberg::io::{StorageBuilderRegistry, StorageBuilder, FileIOBuilder};
174+
/// use iceberg::io::{StorageRegistry, StorageFactory, FileIOBuilder};
175175
/// use std::sync::Arc;
176176
///
177-
/// // Create your custom storage builder
178-
/// let my_builder = Arc::new(MyCustomStorageBuilder);
177+
/// // Create your custom storage factory
178+
/// let my_factory = Arc::new(MyCustomStorageFactory);
179179
///
180180
/// // Register it with a custom scheme
181-
/// let mut registry = StorageBuilderRegistry::new();
182-
/// registry.register("mycustom", my_builder);
181+
/// let mut registry = StorageRegistry::new();
182+
/// registry.register("mycustom", my_factory);
183183
///
184184
/// // Use it to build FileIO
185185
/// let file_io = FileIOBuilder::new("mycustom")
@@ -198,7 +198,7 @@ pub struct FileIOBuilder {
198198
/// Optional extensions to configure the underlying FileIO behavior.
199199
extensions: Extensions,
200200
/// Optional custom registry. If None, a default registry will be created.
201-
registry: Option<StorageBuilderRegistry>,
201+
registry: Option<StorageRegistry>,
202202
}
203203

204204
impl FileIOBuilder {
@@ -232,7 +232,7 @@ impl FileIOBuilder {
232232
String,
233233
HashMap<String, String>,
234234
Extensions,
235-
Option<StorageBuilderRegistry>,
235+
Option<StorageRegistry>,
236236
) {
237237
(
238238
self.scheme_str.unwrap_or_default(),
@@ -276,7 +276,7 @@ impl FileIOBuilder {
276276
self.extensions.get::<T>()
277277
}
278278

279-
/// Sets a custom storage builder registry.
279+
/// Sets a custom storage registry.
280280
///
281281
/// This allows you to register custom storage implementations that can be used
282282
/// when building the FileIO. If not set, a default registry with built-in
@@ -285,17 +285,17 @@ impl FileIOBuilder {
285285
/// # Example
286286
///
287287
/// ```rust,ignore
288-
/// use iceberg::io::{StorageBuilderRegistry, FileIOBuilder};
288+
/// use iceberg::io::{StorageRegistry, FileIOBuilder};
289289
/// use std::sync::Arc;
290290
///
291-
/// let mut registry = StorageBuilderRegistry::new();
292-
/// registry.register("mycustom", Arc::new(MyCustomStorageBuilder));
291+
/// let mut registry = StorageRegistry::new();
292+
/// registry.register("mycustom", Arc::new(MyCustomStorageFactory));
293293
///
294294
/// let file_io = FileIOBuilder::new("mycustom")
295295
/// .with_registry(registry)
296296
/// .build()?;
297297
/// ```
298-
pub fn with_registry(mut self, registry: StorageBuilderRegistry) -> Self {
298+
pub fn with_registry(mut self, registry: StorageRegistry) -> Self {
299299
self.registry = Some(registry);
300300
self
301301
}
@@ -308,13 +308,13 @@ impl FileIOBuilder {
308308
// Use custom registry if provided, otherwise create default
309309
let registry = self.registry.clone().unwrap_or_default();
310310

311-
let builder = registry.get_builder(scheme.as_str())?;
311+
let factory = registry.get_factory(scheme.as_str())?;
312312

313313
let mut props_with_scheme = self.props.clone();
314314
props_with_scheme.insert(STORAGE_LOCATION_SCHEME.to_string(), scheme);
315315

316316
// Build storage with props and extensions
317-
let storage = builder.build(props_with_scheme, self.extensions.clone())?;
317+
let storage = factory.build(props_with_scheme, self.extensions.clone())?;
318318

319319
Ok(FileIO {
320320
builder: self,
@@ -528,7 +528,7 @@ mod tests {
528528
use super::{FileIO, FileIOBuilder};
529529
use crate::io::{
530530
Extensions, FileMetadata, FileRead, FileWrite, InputFile, OutputFile,
531-
STORAGE_LOCATION_SCHEME, Storage, StorageBuilder, StorageBuilderRegistry,
531+
STORAGE_LOCATION_SCHEME, Storage, StorageFactory, StorageRegistry,
532532
};
533533
use crate::{Error, ErrorKind, Result};
534534

@@ -600,14 +600,14 @@ mod tests {
600600
}
601601
}
602602

603-
// Test storage builder
603+
// Test storage factory
604604
#[derive(Debug)]
605-
struct TestStorageBuilder {
605+
struct TestStorageFactory {
606606
written: Arc<Mutex<Vec<String>>>,
607607
received_props: Arc<Mutex<HashMap<String, String>>>,
608608
}
609609

610-
impl TestStorageBuilder {
610+
impl TestStorageFactory {
611611
pub fn written(&self) -> MutexGuard<'_, Vec<String>> {
612612
self.written.lock().unwrap()
613613
}
@@ -617,7 +617,7 @@ mod tests {
617617
}
618618
}
619619

620-
impl StorageBuilder for TestStorageBuilder {
620+
impl StorageFactory for TestStorageFactory {
621621
fn build(
622622
&self,
623623
props: HashMap<String, String>,
@@ -777,13 +777,13 @@ mod tests {
777777
#[test]
778778
fn test_custom_registry() {
779779
// Create a custom registry and register test storage
780-
let builder = Arc::new(TestStorageBuilder {
780+
let factory = Arc::new(TestStorageFactory {
781781
written: Arc::new(Mutex::new(Vec::new())),
782782
received_props: Arc::new(Mutex::new(HashMap::new())),
783783
});
784784

785-
let mut registry = StorageBuilderRegistry::new();
786-
registry.register("test", builder.clone());
785+
let mut registry = StorageRegistry::new();
786+
registry.register("test", factory.clone());
787787

788788
// Build FileIO with custom storage
789789
let file_io = FileIOBuilder::new("test")
@@ -799,13 +799,13 @@ mod tests {
799799
#[tokio::test]
800800
async fn test_custom_registry_operations() {
801801
// Create test storage with write tracking
802-
let builder = Arc::new(TestStorageBuilder {
802+
let factory = Arc::new(TestStorageFactory {
803803
written: Arc::new(Mutex::new(Vec::new())),
804804
received_props: Arc::new(Mutex::new(HashMap::new())),
805805
});
806806

807-
let mut registry = StorageBuilderRegistry::new();
808-
registry.register("test", builder.clone());
807+
let mut registry = StorageRegistry::new();
808+
registry.register("test", factory.clone());
809809

810810
// Build FileIO with test storage
811811
let file_io = FileIOBuilder::new("test")
@@ -825,21 +825,21 @@ mod tests {
825825
assert_eq!(metadata.size, 42);
826826

827827
// Verify write was tracked
828-
let tracked = builder.written();
828+
let tracked = factory.written();
829829
assert_eq!(tracked.len(), 1);
830830
assert_eq!(tracked[0], "test://bucket/file.txt");
831831
}
832832

833833
#[test]
834834
fn test_scheme_and_props_propagation() {
835835
// Create test storage that captures props
836-
let builder = Arc::new(TestStorageBuilder {
836+
let factory = Arc::new(TestStorageFactory {
837837
written: Arc::new(Mutex::new(Vec::new())),
838838
received_props: Arc::new(Mutex::new(HashMap::new())),
839839
});
840840

841-
let mut registry = StorageBuilderRegistry::new();
842-
registry.register("myscheme", builder.clone());
841+
let mut registry = StorageRegistry::new();
842+
registry.register("myscheme", factory.clone());
843843

844844
// Build FileIO with custom scheme and additional props
845845
let file_io = FileIOBuilder::new("myscheme")
@@ -851,8 +851,8 @@ mod tests {
851851
// Verify the storage was created
852852
assert!(file_io.new_output("myscheme://test.txt").is_ok());
853853

854-
// Verify the scheme was propagated to the builder
855-
let props = builder.received_props();
854+
// Verify the scheme was propagated to the factory
855+
let props = factory.received_props();
856856
assert_eq!(
857857
props.get(STORAGE_LOCATION_SCHEME),
858858
Some(&"myscheme".to_string())
@@ -863,7 +863,7 @@ mod tests {
863863

864864
#[test]
865865
fn test_into_parts_includes_registry() {
866-
let registry = StorageBuilderRegistry::new();
866+
let registry = StorageRegistry::new();
867867

868868
let builder = FileIOBuilder::new("memory")
869869
.with_prop("key", "value")

crates/iceberg/src/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ mod file_io;
7070
mod storage;
7171

7272
pub use file_io::*;
73-
pub use storage::{Storage, StorageBuilder, StorageBuilderRegistry};
73+
pub use storage::{Storage, StorageFactory, StorageRegistry};
7474
pub(crate) mod object_cache;
7575

7676
/// Property key used to pass the scheme string from FileIOBuilder to StorageBuilder.

0 commit comments

Comments
 (0)