git.delta.rocks / jrsonnet / refs/commits / c6d77aa9f34e

difftreelog

feat remove lock

Yaroslav Bolyukin2021-07-10parent: #e6bd094.patch.diff
in: trunk
Building is locked on nix store anyway

1 file changed

modifiedsrc/db/db.rsdiffbeforeafterboth
15struct DbInternal {15struct DbInternal {
16 root: PathBuf,16 root: PathBuf,
17 locked_paths: HashSet<PathBuf>,17 locked_paths: HashSet<PathBuf>,
18 _lockfile: lockfile::Lockfile,
19}18}
2019
21pub trait DbData: DeserializeOwned + Serialize + Default {20pub trait DbData: DeserializeOwned + Serialize + Default {
32 pub fn new(root: impl AsRef<Path>) -> Result<Self> {31 pub fn new(root: impl AsRef<Path>) -> Result<Self> {
33 let root: &Path = root.as_ref();32 let root: &Path = root.as_ref();
34 std::fs::create_dir_all(&root).context("db root")?;33 std::fs::create_dir_all(&root).context("db root")?;
35 let mut lockfile = root.to_owned();
36 lockfile.push(".lock");
37 let lockfile = lockfile::Lockfile::create(lockfile).context("db lock")?;
38 Ok(Db(Arc::new(Mutex::new(DbInternal {34 Ok(Db(Arc::new(Mutex::new(DbInternal {
39 root: root.to_owned(),35 root: root.to_owned(),
40 locked_paths: HashSet::new(),36 locked_paths: HashSet::new(),
41 _lockfile: lockfile,
42 }))))37 }))))
43 }38 }
4439