Skip to content

Commit

Permalink
Cache the workspace directory mtime.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 9, 2024
1 parent 94550a5 commit a5404a0
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 99 deletions.
3 changes: 2 additions & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ completed **directories** is read.
### The cache files

Row maintains the state of the workflow in several files:
* `values.json`
* `directories.json`
* Last time the workspace was modified.
* Cached copies of the user-provided static value file.
* `completed.postcard`
* Completion status for each **action**.
Expand Down
2 changes: 1 addition & 1 deletion doc/src/guide/concepts/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ invalid when:

> To recover from such a change, execute:
> ```bash
> row clean --value
> row clean --directory
> ```
## Submitted jobs
Expand Down
10 changes: 5 additions & 5 deletions doc/src/row/clean.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Usage
```bash
row clean [OPTIONS] <--value|--submitted|--completed|--all>
row clean [OPTIONS] <--directory|--submitted|--completed|--all>
```

`row clean` safely removes cache files generated by **row**. The
Expand All @@ -19,13 +19,13 @@ Remove all caches.

Remove the cache of completed actions on directories.

### `--submitted`
### `--directory`

Remove the cache of submitted jobs.
Remove the directory value cache.

### `--value`
### `--submitted`

Remove the directory value cache.
Remove the cache of submitted jobs.

### `--force`

Expand Down
12 changes: 6 additions & 6 deletions src/cli/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::cli::GlobalOptions;
use row::project::Project;
use row::MultiProgressContainer;
use row::{
COMPLETED_CACHE_FILE_NAME, DATA_DIRECTORY_NAME, SUBMITTED_CACHE_FILE_NAME,
VALUE_CACHE_FILE_NAME,
COMPLETED_CACHE_FILE_NAME, DATA_DIRECTORY_NAME, DIRECTORY_CACHE_FILE_NAME,
SUBMITTED_CACHE_FILE_NAME,
};

#[derive(Args, Debug)]
Expand All @@ -25,9 +25,9 @@ pub struct Arguments {
#[group(required = true, multiple = false)]
#[allow(clippy::struct_excessive_bools)]
pub struct Selection {
/// Remove the value cache.
/// Remove the directory cache.
#[arg(long, display_order = 0)]
value: bool,
directory: bool,

/// Remove the submitted cache.
#[arg(long, display_order = 0)]
Expand Down Expand Up @@ -97,8 +97,8 @@ pub fn clean(
}
}
}
if selection.value || selection.all {
let path = data_directory.join(VALUE_CACHE_FILE_NAME);
if selection.directory || selection.all {
let path = data_directory.join(DIRECTORY_CACHE_FILE_NAME);
info!("Removing '{}'.", path.display());
if let Err(error) = fs::remove_file(&path) {
match error.kind() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub const DATA_DIRECTORY_NAME: &str = ".row";
pub const COMPLETED_DIRECTORY_NAME: &str = "completed";
pub const MIN_PROGRESS_BAR_SIZE: usize = 1;

pub const VALUE_CACHE_FILE_NAME: &str = "values.json";
pub const DIRECTORY_CACHE_FILE_NAME: &str = "directories.json";
pub const COMPLETED_CACHE_FILE_NAME: &str = "completed.postcard";
pub const SUBMITTED_CACHE_FILE_NAME: &str = "submitted.postcard";

Expand Down
Loading

0 comments on commit a5404a0

Please sign in to comment.