@@ -25,6 +25,7 @@ use crate::transaction::WriteContext;
2525use crate :: {
2626 DeltaResult , Engine , EngineData , EvaluationHandler , JsonHandler , ParquetHandler , StorageHandler ,
2727} ;
28+ use delta_kernel_derive:: internal_api;
2829
2930pub mod executor;
3031pub mod file_stream;
@@ -51,11 +52,31 @@ impl<E: TaskExecutor> DefaultEngine<E> {
5152 /// - `table_root`: The URL of the table within storage.
5253 /// - `options`: key/value pairs of options to pass to the object store.
5354 /// - `task_executor`: Used to spawn async IO tasks. See [executor::TaskExecutor].
54- /// - `reporter`: Optional metrics reporter for tracking operation metrics.
5555 pub fn try_new < K , V > (
5656 table_root : & Url ,
5757 options : impl IntoIterator < Item = ( K , V ) > ,
5858 task_executor : Arc < E > ,
59+ ) -> DeltaResult < Self >
60+ where
61+ K : AsRef < str > ,
62+ V : Into < String > ,
63+ {
64+ Self :: try_new_with_metrics ( table_root, options, task_executor, None )
65+ }
66+
67+ /// Create a new [`DefaultEngine`] instance with metrics reporting
68+ ///
69+ /// # Parameters
70+ ///
71+ /// - `table_root`: The URL of the table within storage.
72+ /// - `options`: key/value pairs of options to pass to the object store.
73+ /// - `task_executor`: Used to spawn async IO tasks. See [executor::TaskExecutor].
74+ /// - `reporter`: Optional metrics reporter for tracking operation metrics.
75+ #[ internal_api]
76+ pub ( crate ) fn try_new_with_metrics < K , V > (
77+ table_root : & Url ,
78+ options : impl IntoIterator < Item = ( K , V ) > ,
79+ task_executor : Arc < E > ,
5980 reporter : Option < Arc < dyn crate :: metrics:: MetricsReporter > > ,
6081 ) -> DeltaResult < Self >
6182 where
@@ -64,7 +85,7 @@ impl<E: TaskExecutor> DefaultEngine<E> {
6485 {
6586 // table root is the path of the table in the ObjectStore
6687 let ( object_store, _table_root) = parse_url_opts ( table_root, options) ?;
67- Ok ( Self :: new ( Arc :: new ( object_store) , task_executor, reporter) )
88+ Ok ( Self :: new_with_metrics ( Arc :: new ( object_store) , task_executor, reporter) )
6889 }
6990
7091 /// Create a new [`DefaultEngine`] instance
@@ -73,10 +94,24 @@ impl<E: TaskExecutor> DefaultEngine<E> {
7394 ///
7495 /// - `object_store`: The object store to use.
7596 /// - `task_executor`: Used to spawn async IO tasks. See [executor::TaskExecutor].
76- /// - `reporter`: Optional metrics reporter for tracking operation metrics.
7797 pub fn new (
7898 object_store : Arc < DynObjectStore > ,
7999 task_executor : Arc < E > ,
100+ ) -> Self {
101+ Self :: new_with_metrics ( object_store, task_executor, None )
102+ }
103+
104+ /// Create a new [`DefaultEngine`] instance with metrics reporting
105+ ///
106+ /// # Parameters
107+ ///
108+ /// - `object_store`: The object store to use.
109+ /// - `task_executor`: Used to spawn async IO tasks. See [executor::TaskExecutor].
110+ /// - `reporter`: Optional metrics reporter for tracking operation metrics.
111+ #[ internal_api]
112+ pub ( crate ) fn new_with_metrics (
113+ object_store : Arc < DynObjectStore > ,
114+ task_executor : Arc < E > ,
80115 reporter : Option < Arc < dyn crate :: metrics:: MetricsReporter > > ,
81116 ) -> Self {
82117 Self {
@@ -188,7 +223,7 @@ mod tests {
188223 let url = Url :: from_directory_path ( tmp. path ( ) ) . unwrap ( ) ;
189224 let object_store = Arc :: new ( LocalFileSystem :: new ( ) ) ;
190225 let engine =
191- DefaultEngine :: new ( object_store, Arc :: new ( TokioBackgroundExecutor :: new ( ) ) , None ) ;
226+ DefaultEngine :: new ( object_store, Arc :: new ( TokioBackgroundExecutor :: new ( ) ) ) ;
192227 test_arrow_engine ( & engine, & url) ;
193228 }
194229
0 commit comments