{"id":22941568,"url":"https://github.com/andrewshadura/rust-flopen","last_synced_at":"2025-10-09T08:45:32.251Z","repository":{"id":57630489,"uuid":"417444384","full_name":"andrewshadura/rust-flopen","owner":"andrewshadura","description":"Reliably open and lock a file (also known as flopen)","archived":false,"fork":false,"pushed_at":"2024-01-09T11:38:56.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-28T17:58:39.392Z","etag":null,"topics":["flopen","lockfile","locks","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewshadura.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-15T09:34:40.000Z","updated_at":"2024-01-29T12:08:41.000Z","dependencies_parsed_at":"2024-12-14T13:44:25.247Z","dependency_job_id":"ba9d2e52-9f7c-467a-bc6d-e1742a20f4aa","html_url":"https://github.com/andrewshadura/rust-flopen","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"3d7bb3253734c278d0f4ee7b1d3dffe1d5ee9230"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/andrewshadura/rust-flopen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewshadura%2Frust-flopen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewshadura%2Frust-flopen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewshadura%2Frust-flopen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewshadura%2Frust-flopen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewshadura","download_url":"https://codeload.github.com/andrewshadura/rust-flopen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewshadura%2Frust-flopen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271073387,"owners_count":24694538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flopen","lockfile","locks","rust"],"created_at":"2024-12-14T13:44:22.154Z","updated_at":"2025-10-09T08:45:32.194Z","avatar_url":"https://github.com/andrewshadura.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Reliably open and lock files\n============================\n\nThis crates provides a way to reliably open and lock a file, for example\nfor opening lock files, PID files, spool files, mailboxes and other kinds\nof files which are used for synchronisation between processes.\n\nThe `OpenAndLock` trait implements the algorithm of the\n[`flopen`][] function available on BSD systems. It is roughly equivalent\nto opening a file and calling [`flock`][] with an `operation` argument\nset to `LOCK_EX`, but it also attempts to detect and handle races between\nopening or creating the file and locking it.\n\nThe trait provides two implementations, a blocking and a non-blocking one.\n\nThe `open_and_lock()` method waits until the file can be locked, so unless\nan unrelated I/O error occurs, it will eventually succeed once the file has\nbeen released if it’s been held by a different process.\n\nThe `try_open_and_lock()` method returns an error immediately when the file\ncannot be locked, allowing the called to handle it and retry if necessary.\n\nBoth methods retry automatically when a race condition occurs and a file\ngets deleted or recreated directly after the lock has been acquired.\n\nThis trait extends `OpenOptions`, so it can be used the following way:\n```\nlet file = OpenOptions::new()\n    .read(true)\n    .write(true)\n    .create(true)\n    .open_and_lock(\"/path/to/file\")?;\n```\n\nAt the moment, this crate supports UNIX-like platforms only.\n\n[`flopen`]: https://manpages.debian.org/flopen\n[`flock`]: https://manpages.debian.org/2/flock\n\nLicense\n-------\n\n[MIT license](LICENSE-MIT), also known as the Expat license.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you shall be licensed as above, without any additional\nterms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewshadura%2Frust-flopen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewshadura%2Frust-flopen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewshadura%2Frust-flopen/lists"}