an efficient binary archive format
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove fs3 dependency

zach 7397663d 1b07fd52

+5 -6
+1 -1
Cargo.toml
··· 10 10 documentation = "https://docs.rs/bindle-file" 11 11 repository = "https://tangled.org/zachshipko.com/bindle-file" 12 12 default-run = "bindle" 13 + rust-version = "1.89.0" 13 14 14 15 [lib] 15 16 crate-type = ["cdylib", "staticlib", "rlib"] ··· 23 24 memmap2 = "0.9.9" 24 25 zerocopy = { version = "0.8", features = ["std", "derive"] } 25 26 zstd = "0.13" 26 - fs2 = "0.4" 27 27 clap = { version = "4.5", features = ["derive"], optional = true } 28 28 29 29 [features]
+4 -5
src/bindle.rs
··· 1 1 use crc32fast::Hasher; 2 - use fs2::FileExt; 3 2 use memmap2::Mmap; 4 3 use std::borrow::Cow; 5 4 use std::collections::BTreeMap; ··· 190 189 /// 191 190 /// Must be called after add/remove operations to make changes persistent. 192 191 pub fn save(&mut self) -> io::Result<()> { 193 - self.file.lock_exclusive()?; 192 + self.file.lock()?; 194 193 self.file.seek(SeekFrom::Start(self.data_end))?; 195 194 let index_start = self.data_end; 196 195 ··· 235 234 .truncate(true) 236 235 .open(&temp_path)?; 237 236 238 - temp_file.lock_exclusive()?; 237 + temp_file.lock()?; 239 238 temp_file.write_all(BNDL_MAGIC)?; 240 239 let mut current_offset = HEADER_SIZE as u64; 241 240 ··· 272 271 temp_file.sync_all()?; 273 272 274 273 // Acquire exclusive lock just before rename to prevent concurrent access 275 - self.file.lock_exclusive()?; 274 + self.file.lock()?; 276 275 277 276 // Release locks and close current file 278 277 drop(self.mmap.take()); ··· 511 510 /// 512 511 /// The writer must be closed and then [`save()`](Bindle::save) must be called to commit the entry. 513 512 pub fn writer<'a>(&'a mut self, name: &str, compress: Compress) -> io::Result<Writer<'a>> { 514 - self.file.lock_exclusive()?; 513 + self.file.lock()?; 515 514 // Only seek if not already at the correct position 516 515 let current_pos = self.file.stream_position()?; 517 516 if current_pos != self.data_end {