Skip to content

Commit 565c565

Browse files
committed
fix: add missing dependencies and imports for streaming output
- Add uffs-polars and chrono dependencies to uffs-cli - Re-add progress bar helper functions (create_multi_progress, add_drive_progress) - Fix imports: use uffs_polars for AnyValue/TimeUnit/Column types - Add IntoLazy import for .lazy() method on DataFrame - Use local col() import instead of uffs_mft::col() These fixes resolve Windows cross-compilation errors where polars types were not accessible through uffs_mft.
1 parent d3a8080 commit 565c565

File tree

6 files changed

+62
-16
lines changed

6 files changed

+62
-16
lines changed

Cargo.lock

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ members = [
3232
# Workspace Package Metadata (inherited by all crates)
3333
# ─────────────────────────────────────────────────────────────────────────────
3434
[workspace.package]
35-
version = "0.2.8"
35+
version = "0.2.9"
3636
edition = "2024"
3737
rust-version = "1.85"
3838
license = "MPL-2.0 OR LicenseRef-UFFS-Commercial"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Traditional file search tools (including `os.walk`, `FindFirstFile`, etc.) work
2121

2222
**UFFS reads the MFT directly** - once - and queries it in memory using Polars DataFrames. This is like reading the entire phonebook once instead of looking up each name individually.
2323

24-
### Benchmark Results (v0.2.8)
24+
### Benchmark Results (v0.2.9)
2525

2626
| Drive Type | Records | Time | Throughput |
2727
|------------|---------|------|------------|
@@ -33,7 +33,7 @@ Traditional file search tools (including `os.walk`, `FindFirstFile`, etc.) work
3333

3434
| Comparison | Records | Time | Notes |
3535
|------------|---------|------|-------|
36-
| **UFFS v0.2.8** | **18.7 Million** | **~142 seconds** | All disks, fast mode |
36+
| **UFFS v0.2.9** | **18.7 Million** | **~142 seconds** | All disks, fast mode |
3737
| UFFS v0.1.30 | 18.7 Million | ~315 seconds | Baseline |
3838
| Everything | 19 Million | 178 seconds | All disks |
3939
| WizFile | 6.5 Million | 299 seconds | Single HDD |

crates/uffs-cli/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ tracing.workspace = true
4646
tracing-subscriber.workspace = true
4747
tracing-appender.workspace = true
4848
dirs-next.workspace = true
49+
uffs-polars = { version = "0.2.9", path = "../uffs-polars" }
50+
chrono.workspace = true
4951

5052
# Memory allocator (Windows only - reduces fragmentation)
5153
[target.'cfg(windows)'.dependencies]

crates/uffs-cli/src/commands.rs

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,49 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
1313
use std::sync::{Arc, Mutex};
1414

1515
use anyhow::{Context, Result, bail};
16+
#[cfg(windows)]
17+
use indicatif::MultiProgress;
1618
use indicatif::{ProgressBar, ProgressStyle};
1719
use tracing::info;
1820
use uffs_core::extensions::ExtensionFilter;
1921

22+
/// Check if progress bars are disabled via `UFFS_NO_PROGRESS=1` environment
23+
/// variable.
24+
#[cfg(windows)]
25+
#[inline]
26+
fn is_progress_disabled() -> bool {
27+
std::env::var("UFFS_NO_PROGRESS")
28+
.map(|val| val == "1" || val.eq_ignore_ascii_case("true"))
29+
.unwrap_or(false)
30+
}
31+
32+
/// Create a multi-progress container for multiple drives.
33+
/// Returns `None` if progress is disabled via `UFFS_NO_PROGRESS=1`.
34+
#[cfg(windows)]
35+
fn create_multi_progress() -> Option<MultiProgress> {
36+
if is_progress_disabled() {
37+
None
38+
} else {
39+
Some(MultiProgress::new())
40+
}
41+
}
42+
43+
/// Add a drive progress bar to a multi-progress container.
44+
#[cfg(windows)]
45+
fn add_drive_progress(multi_progress: &MultiProgress, drive: char) -> ProgressBar {
46+
let progress_bar = multi_progress.add(ProgressBar::new(0));
47+
let template = format!(
48+
"{{spinner:.cyan}} [{drive}:] [{{elapsed_precise}}] {{bar:30.cyan/blue}} {{bytes}}/{{total_bytes}} ({{eta}})"
49+
);
50+
progress_bar.set_style(
51+
ProgressStyle::default_bar()
52+
.template(&template)
53+
.unwrap_or_else(|_| ProgressStyle::default_bar())
54+
.progress_chars("━━╸"),
55+
);
56+
progress_bar
57+
}
58+
2059
/// Streaming output writer for multi-drive search.
2160
///
2261
/// Supports CSV (header + rows) and NDJSON (one JSON object per line) formats.
@@ -187,8 +226,8 @@ impl<W: Write> StreamingWriter<W> {
187226

188227
/// Format a cell value for CSV output.
189228
#[cfg(windows)]
190-
fn format_cell_value(col: &uffs_mft::polars::prelude::Column, row_idx: usize) -> String {
191-
use uffs_mft::polars::prelude::*;
229+
fn format_cell_value(col: &uffs_polars::Column, row_idx: usize) -> String {
230+
use uffs_polars::{AnyValue, TimeUnit};
192231

193232
let val = col.get(row_idx);
194233
match val {
@@ -212,8 +251,8 @@ fn format_cell_value(col: &uffs_mft::polars::prelude::Column, row_idx: usize) ->
212251

213252
/// Format a cell value for JSON output.
214253
#[cfg(windows)]
215-
fn format_json_value(col: &uffs_mft::polars::prelude::Column, row_idx: usize) -> String {
216-
use uffs_mft::polars::prelude::*;
254+
fn format_json_value(col: &uffs_polars::Column, row_idx: usize) -> String {
255+
use uffs_polars::{AnyValue, TimeUnit};
217256

218257
let val = col.get(row_idx);
219258
match val {
@@ -911,7 +950,7 @@ async fn search_multi_drive_streaming<W: Write + Send + 'static>(
911950
writer: W,
912951
) -> Result<()> {
913952
use tokio::sync::mpsc;
914-
use uffs_mft::lit;
953+
use uffs_mft::{IntoLazy, col, lit};
915954

916955
if drives.is_empty() {
917956
bail!("No drives specified for multi-drive search");
@@ -1060,7 +1099,7 @@ async fn search_multi_drive_streaming<W: Write + Send + 'static>(
10601099
.collect();
10611100
let columns: Vec<_> = std::iter::once("drive".to_string())
10621101
.chain(column_names)
1063-
.map(|s| uffs_mft::col(&s))
1102+
.map(|s| col(&s))
10641103
.collect();
10651104

10661105
if let Ok(reordered) = df.clone().lazy().select(columns).collect() {

crates/uffs-cli/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
//! RUST_LOG=trace RUST_LOG_FILE=trace uffs search *.txt
2424
//! ```
2525
26+
// Dependencies used in commands.rs for streaming output (Windows-only code
27+
// paths)
2628
use std::io::stdout;
2729
use std::path::PathBuf;
2830

@@ -35,6 +37,7 @@ use mimalloc::MiMalloc;
3537
use tracing_subscriber::fmt::time::UtcTime;
3638
use tracing_subscriber::layer::SubscriberExt;
3739
use tracing_subscriber::{EnvFilter, Layer};
40+
use {chrono as _, uffs_polars as _};
3841

3942
#[cfg(target_os = "windows")]
4043
#[global_allocator]

0 commit comments

Comments
 (0)