Skip to content

Commit 7ef6eb5

Browse files
committed
better
1 parent 4b97704 commit 7ef6eb5

5 files changed

Lines changed: 42 additions & 11 deletions

File tree

ffi/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ fn get_default_engine_impl(
565565
&url,
566566
options,
567567
Arc::new(TokioBackgroundExecutor::new()),
568-
None,
569568
);
570569
Ok(engine_to_handle(Arc::new(engine?), allocate_error))
571570
}

kernel/examples/common/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,13 @@ pub fn get_engine(
161161
Ok(DefaultEngine::new(
162162
store,
163163
Arc::new(TokioBackgroundExecutor::new()),
164-
None,
165164
))
166165
} else if !args.option.is_empty() {
167166
let opts = args.option.iter().map(|option| {
168167
let parts: Vec<&str> = option.split("=").collect();
169168
(parts[0].to_ascii_lowercase(), parts[1])
170169
});
171-
DefaultEngine::try_new(url, opts, Arc::new(TokioBackgroundExecutor::new()), None)
170+
DefaultEngine::try_new(url, opts, Arc::new(TokioBackgroundExecutor::new()))
172171
} else {
173172
let mut options = if let Some(ref region) = args.region {
174173
HashMap::from([("region", region.clone())])
@@ -178,7 +177,7 @@ pub fn get_engine(
178177
if args.public {
179178
options.insert("skip_signature", "true".to_string());
180179
}
181-
DefaultEngine::try_new(url, options, Arc::new(TokioBackgroundExecutor::new()), None)
180+
DefaultEngine::try_new(url, options, Arc::new(TokioBackgroundExecutor::new()))
182181
}
183182
}
184183

kernel/examples/write-table/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ async fn try_main() -> DeltaResult<()> {
8080
&url,
8181
HashMap::<String, String>::new(),
8282
Arc::new(TokioBackgroundExecutor::new()),
83-
None,
8483
)?;
8584

8685
// Create or get the table

kernel/src/engine/default/mod.rs

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use crate::transaction::WriteContext;
2525
use crate::{
2626
DeltaResult, Engine, EngineData, EvaluationHandler, JsonHandler, ParquetHandler, StorageHandler,
2727
};
28+
use delta_kernel_derive::internal_api;
2829

2930
pub mod executor;
3031
pub 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

test-utils/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ impl DefaultEngineExtension for DefaultEngine<TokioBackgroundExecutor> {
213213
Arc::new(DefaultEngine::new(
214214
object_store,
215215
TokioBackgroundExecutor::new().into(),
216-
None,
217216
))
218217
}
219218
}
@@ -238,7 +237,7 @@ pub fn engine_store_setup(
238237
),
239238
};
240239
let executor = Arc::new(TokioBackgroundExecutor::new());
241-
let engine = DefaultEngine::new(Arc::clone(&storage), executor, None);
240+
let engine = DefaultEngine::new(Arc::clone(&storage), executor);
242241

243242
(storage, engine, url)
244243
}

0 commit comments

Comments
 (0)