sdd commented on code in PR #512:
URL: https://github.com/apache/iceberg-rust/pull/512#discussion_r1712255347


##########
crates/iceberg/src/table.rs:
##########
@@ -16,28 +16,156 @@
 // under the License.
 
 //! Table API for Apache Iceberg
-use typed_builder::TypedBuilder;
+
+use std::sync::Arc;
 
 use crate::arrow::ArrowReaderBuilder;
+use crate::io::object_cache::ObjectCache;
 use crate::io::FileIO;
 use crate::scan::TableScanBuilder;
 use crate::spec::{TableMetadata, TableMetadataRef};
-use crate::{Result, TableIdent};
+use crate::{Error, ErrorKind, Result, TableIdent};
+
+/// Builder to create table scan.
+pub struct TableBuilder {
+    file_io: Option<FileIO>,
+    metadata_location: Option<String>,
+    metadata: Option<TableMetadataRef>,
+    identifier: Option<TableIdent>,
+    readonly: bool,
+    disable_cache: bool,
+    cache_size_bytes: Option<u64>,
+}
+
+impl TableBuilder {
+    pub(crate) fn new() -> Self {
+        Self {
+            file_io: None,
+            metadata_location: None,
+            metadata: None,
+            identifier: None,
+            readonly: false,
+            disable_cache: false,
+            cache_size_bytes: None,
+        }
+    }
+
+    /// required - sets the necessary FileIO to use for the table
+    pub fn file_io(mut self, file_io: FileIO) -> Self {
+        self.file_io = Some(file_io);
+        self
+    }
+
+    /// optional - sets the tables metadata location
+    pub fn metadata_location<T: Into<String>>(mut self, metadata_location: T) 
-> Self {
+        self.metadata_location = Some(metadata_location.into());
+        self
+    }
+
+    /// required - passes in the TableMetadata to use for the Table
+    pub fn metadata<T: Into<TableMetadataRef>>(mut self, metadata: T) -> Self {
+        self.metadata = Some(metadata.into());
+        self
+    }
+
+    /// required - passes in the TableIdent to use for the Table
+    pub fn identifier(mut self, identifier: TableIdent) -> Self {
+        self.identifier = Some(identifier);
+        self
+    }
+
+    /// specifies if the Table is readonly or not (default not)
+    pub fn readonly(mut self, readonly: bool) -> Self {
+        self.readonly = readonly;
+        self
+    }
+
+    /// specifies if the Table's metadata cache will be disabled,
+    /// so that reads of Manifests and ManifestLists will never
+    /// get cached.
+    pub fn disable_cache(mut self) -> Self {
+        self.disable_cache = true;
+        self
+    }
+
+    /// optionally set a non-default metadata cache size
+    pub fn cache_size_bytes(mut self, cache_size_bytes: u64) -> Self {
+        self.cache_size_bytes = Some(cache_size_bytes);
+        self
+    }

Review Comment:
   I like the sound of this! Look forwards to working with you on this 
afterwards :-) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to