Skip to content

Commit

Permalink
Cleanups while preparing for 0.1.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkorunic committed Sep 20, 2022
1 parent 3fe64de commit 92554ff
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 20 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
echo "version is: ${{ env.FL_VERSION }}"
- name: Create GitHub release
id: release
uses: actions/create-release@v1
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -54,12 +54,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Install Rust
uses: dtolnay/rust-toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
Expand Down Expand Up @@ -99,10 +99,14 @@ jobs:
run: |
outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")"
staging="findlargedir-${{ needs.create-release.outputs.fl_version }}-${{ matrix.target }}"
cp {README.md,LICENSE} "$staging/"
mkdir -p "$staging"
cp {README.md,LICENSE} "$staging"
cp "target/${{ matrix.target }}/release/findlargedir" "$staging"
tar -cJf "$staging.tar.xz" "$staging"
echo "ASSET=$staging.tar.xz" >> $GITHUB_ENV
- name: Upload release archive
uses: actions/[email protected].1
uses: actions/[email protected].2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
findlargedir
===
# findlargedir

[![GitHub license](https://img.shields.io/github/license/dkorunic/findlargedir.svg)](https://github.com/dkorunic/findlargedir/blob/master/LICENSE.txt)
[![GitHub release](https://img.shields.io/github/release/dkorunic/findlargedir.svg)](https://github.com/dkorunic/findlargedir/releases/latest)
Expand All @@ -12,9 +11,8 @@ Program will **not follow symlinks** and **requires r/w permissions** to be able

## Caveats

* requires r/w privileges for an each filesystem being tested, it will also create a temporary directory with a lot of temporary files which are cleaned up afterwards
* accurate mode (`-a`) can cause an excessive I/O and an excessive memory use; only use when appropriate

- requires r/w privileges for an each filesystem being tested, it will also create a temporary directory with a lot of temporary files which are cleaned up afterwards
- accurate mode (`-a`) can cause an excessive I/O and an excessive memory use; only use when appropriate

## Usage

Expand All @@ -37,4 +35,5 @@ OPTIONS:

When using **accurate mode** (`-a` parameter) beware that large directory lookups will stall the process completely for extended periods of time. What this mode does is basically a secondary fully accurate pass on a possibly offending directory calculating exact number of entries.

If you want to avoid descending into mounted filesystems (as in find -xdev option), use **onefilesystem mode** with `-o` parameter and this toggled by default.
If you want to avoid descending into mounted filesystems (as in find -xdev option), use **onefilesystem mode** with `-o` parameter and this toggled by default.

19 changes: 19 additions & 0 deletions ci/cargo-out-dir
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Finds Cargo's `OUT_DIR` directory from the most recent build.
#
# This requires one parameter corresponding to the target directory
# to search for the build output.

if [ $# != 1 ]; then
echo "Usage: $(basename "$0") <target-dir>" >&2
exit 2
fi

# This works by finding the most recent stamp file, which is produced by
# every ripgrep build.
target_dir="$1"
find "$target_dir" -type f -name findlargedir -print0 \
| xargs -0 ls -t \
| head -n1 \
| xargs dirname
2 changes: 1 addition & 1 deletion src/calibrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::process;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

pub const DEFAULT_TEST_COUNT: u64 = 10000;
pub const DEFAULT_TEST_COUNT: u64 = 100_000;
const ERROR_EXIT: i32 = 1;

pub fn get_inode_ratio(
Expand Down
18 changes: 10 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ static GLOBAL: Jemalloc = Jemalloc;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
#[clap(short, long, default_value_t = calibrate::DEFAULT_TEST_COUNT)]
calibration_count: u64,

#[clap(short, long, default_value_t = false)]
#[clap(short, long, action = clap::ArgAction::Set, default_value_t = false)]
accurate: bool,

#[clap(short, long, default_value_t = true)]
#[clap(short, long, action = clap::ArgAction::Set, default_value_t = true)]
one_filesystem: bool,

#[clap(short = 'A', long, default_value_t = walk::ALERT_COUNT)]
#[clap(short, long, value_parser, default_value_t = calibrate::DEFAULT_TEST_COUNT)]
calibration_count: u64,

#[clap(short = 'A', long, value_parser, default_value_t = walk::ALERT_COUNT)]
alert_threshold: u64,

#[clap(short = 'B', long, default_value_t = walk::BLACKLIST_COUNT)]
#[clap(short = 'B', long, value_parser, default_value_t = walk::BLACKLIST_COUNT)]
blacklist_threshold: u64,

#[clap(required = true, allow_hyphen_values = true)]
#[clap(required = true, value_parser)]
path: Vec<String>,
}

Expand Down Expand Up @@ -62,6 +62,8 @@ fn main() -> Result<(), Error> {
let size_inode_ratio =
calibrate::get_inode_ratio(tmp_dir.path(), &shutdown_calibrate, args.calibration_count)
.context("Unable to calibrate inode to size ratio")?;

println!("Please wait a few seconds while removing calibration test directory...");
drop(tmp_dir);

println!("Scanning filesystem path {} started", &path);
Expand Down

0 comments on commit 92554ff

Please sign in to comment.