Skip to content

Commit

Permalink
Add symlink on latest state
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr Sorokin committed Jun 11, 2024
1 parent 11d4c9e commit 748d06a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/task/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ impl Cluster {
.build()?;

state.dump_by_uid(&state_dir)?;
state.dump_by_path(latest_path)?;
state.symlink_latest(latest_path)?;

Ok(self)
}
Expand Down
5 changes: 5 additions & 0 deletions src/task/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
fmt::Display,
fs::{create_dir_all, remove_dir_all, File},
io::{self, Read, Write},
os::unix::fs,
path::PathBuf,
};

Expand Down Expand Up @@ -112,6 +113,10 @@ impl State {
self.dump_by_path(&format!("{state_dir}/{}.gz", &self.uid))
}

pub fn symlink_latest(&mut self, latest: &str) -> Result<(), io::Error> {
fs::symlink(&format!("{}.gz", &self.uid), latest)
}

pub fn from_latest(args: &ArgMatches) -> Result<Self, StateError> {
let path = format!(
"{}/latest.gz",
Expand Down

0 comments on commit 748d06a

Please sign in to comment.