MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / sync_dir

Function sync_dir

atomic-repository/src/repository/database.rs:242–248  ·  view source on GitHub ↗

Make renames in `dir` durable. Directory fsync is only portable on Unix; elsewhere the renames are still atomic.

(dir: &Path)

Source from the content-addressed store, hash-verified

240/// Make renames in `dir` durable. Directory fsync is only portable on Unix;
241/// elsewhere the renames are still atomic.
242fn sync_dir(dir: &Path) -> Result<(), RepositoryError> {
243 #[cfg(unix)]
244 std::fs::File::open(dir)?.sync_all()?;
245 #[cfg(not(unix))]
246 let _ = dir;
247 Ok(())
248}
249
250fn is_already_open(error: &PristineError) -> bool {
251 matches!(error, PristineError::Database(inner)

Callers 2

merge_legacyFunction · 0.85
retire_legacy_filesFunction · 0.85

Calls 1

openFunction · 0.85

Tested by

no test coverage detected