diff options
Diffstat (limited to 'vendor/gix-lock')
-rw-r--r-- | vendor/gix-lock/.cargo-checksum.json | 1 | ||||
-rw-r--r-- | vendor/gix-lock/CHANGELOG.md | 346 | ||||
-rw-r--r-- | vendor/gix-lock/Cargo.toml | 44 | ||||
-rw-r--r-- | vendor/gix-lock/LICENSE-APACHE | 191 | ||||
-rw-r--r-- | vendor/gix-lock/LICENSE-MIT | 21 | ||||
-rw-r--r-- | vendor/gix-lock/README.md | 5 | ||||
-rw-r--r-- | vendor/gix-lock/src/acquire.rs | 168 | ||||
-rw-r--r-- | vendor/gix-lock/src/backoff.rs | 142 | ||||
-rw-r--r-- | vendor/gix-lock/src/commit.rs | 79 | ||||
-rw-r--r-- | vendor/gix-lock/src/file.rs | 78 | ||||
-rw-r--r-- | vendor/gix-lock/src/lib.rs | 55 |
11 files changed, 1130 insertions, 0 deletions
diff --git a/vendor/gix-lock/.cargo-checksum.json b/vendor/gix-lock/.cargo-checksum.json new file mode 100644 index 000000000..b02bda5f8 --- /dev/null +++ b/vendor/gix-lock/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"7ba0bb4713202e468dbbecfdab8eedea8f57771bcc42f81d7d798875b7eb516c","Cargo.toml":"3a359046d55729bb079a8e138e7f298c04d74a8ecb396c6b6b43a9b7b6c474aa","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","README.md":"cf2fb5b63a81699b01aaa03994874d70af2d8650a047b41350924c8f900c7ea9","src/acquire.rs":"405fa3dce6b9e7035e0966a906da932623ccc323f33ea36f4e7365a9e3c5e5ac","src/backoff.rs":"d8bc6672b6ceb2c70ac335c453904cb102c0a74c25605bd01b5ce4bd5f0e9571","src/commit.rs":"5dd467479f5eed435c7ddc4b5b4b9d89acd88521ce8d747efda92a3ce881df46","src/file.rs":"19c050dcbd5b4f892570fbc0303c254e52bc650fa2559d6a5b16e1f44388c679","src/lib.rs":"528fe39f621458d2b7a0f7c9be042f22f71083c9e031c60faa9ad549e183ecad"},"package":"66119ff8a4a395d0ea033fef718bc85f8b4f0855874f4ce1e005fc16cfe1f66e"}
\ No newline at end of file diff --git a/vendor/gix-lock/CHANGELOG.md b/vendor/gix-lock/CHANGELOG.md new file mode 100644 index 000000000..71e435f59 --- /dev/null +++ b/vendor/gix-lock/CHANGELOG.md @@ -0,0 +1,346 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 4.0.0 (2023-03-01) + +### Chore + + - <csr-id-d08364ce7eb00b052202b623dad92cfda38b812f/> replace `quick-error` with `thiserror` + This increases the compile time of the crate alone if there is no proc-macro + in the dependency tree, but will ever so slightly improve compile times for `gix` + as a whole. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 4 commits contributed to the release over the course of 2 calendar days. + - 11 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Merge branch 'adjustments-for-cargo' ([`d686d94`](https://github.com/Byron/gitoxide/commit/d686d94e1030a8591ba074757d56927a346c8351)) + - Adapt to changes in `gix-tempfile` ([`bfcd1e3`](https://github.com/Byron/gitoxide/commit/bfcd1e3a8f2d05d0d6d1f5cf06d369ac9e6e4cdf)) + - Replace `quick-error` with `thiserror` ([`d08364c`](https://github.com/Byron/gitoxide/commit/d08364ce7eb00b052202b623dad92cfda38b812f)) + - Prepare for git-tempfile release ([`56c005b`](https://github.com/Byron/gitoxide/commit/56c005b13c44376f71e61781e73c0bf93416d0e4)) +</details> + +## 3.0.3 (2023-02-17) + +### Bug Fixes + + - <csr-id-e14dc7d475373d2c266e84ff8f1826c68a34ab92/> note that crates have been renamed from `git-*` to `gix-*`. + This also means that the `git-*` prefixed crates of the `gitoxide` project + are effectively unmaintained. + Use the crates with the `gix-*` prefix instead. + + If you were using `git-repository`, then `gix` is its substitute. + +## 3.0.2 (2023-02-17) + +<csr-id-f7f136dbe4f86e7dee1d54835c420ec07c96cd78/> +<csr-id-533e887e80c5f7ede8392884562e1c5ba56fb9a8/> + +### New Features (BREAKING) + + - <csr-id-3d8fa8fef9800b1576beab8a5bc39b821157a5ed/> upgrade edition to 2021 in most crates. + MSRV for this is 1.56, and we are now at 1.60 so should be compatible. + This isn't more than a patch release as it should break nobody + who is adhering to the MSRV, but let's be careful and mark it + breaking. + + Note that `git-features` and `git-pack` are still on edition 2018 + as they make use of a workaround to support (safe) mutable access + to non-overlapping entries in a slice which doesn't work anymore + in edition 2021. + +### Bug Fixes + + - <csr-id-73ecb40bb20f9c3fe7341f4ff1b0b81ac09b9ae0/> Interpret `PermissionDenied` as reason to retry on lock acquisition failure. + Evidence from CI suggests that on windows 'AlreadyExists' isn't the + common error code. Instead, maybe due to racyness, it can also emit + PermissionDenied errors which we now handle specifically. + +### New Features + + - <csr-id-f9bb71b984045a069f7caf0c650ef24bd3cc0be1/> add `backoff` for an exponential backoff iterator. + It's used for computing the backoff on the lock itself, but is certainly + useful in other occasions as well. + - <csr-id-a789490fbbba1f44d79d57c8ba74bf40c600faf2/> export git-tempfile in the root + This allows access to signal handler setup for example, which can be + useful in some situations. + +### Chore + + - <csr-id-f7f136dbe4f86e7dee1d54835c420ec07c96cd78/> uniformize deny attributes + - <csr-id-533e887e80c5f7ede8392884562e1c5ba56fb9a8/> remove default link to cargo doc everywhere + +### Documentation + + - <csr-id-39ed9eda62b7718d5109135e5ad406fb1fe2978c/> fix typos + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 149 commits contributed to the release over the course of 610 calendar days. + - 7 commits were understood as [conventional](https://www.conventionalcommits.org). + - 6 unique issues were worked on: [#198](https://github.com/Byron/gitoxide/issues/198), [#301](https://github.com/Byron/gitoxide/issues/301), [#364](https://github.com/Byron/gitoxide/issues/364), [#384](https://github.com/Byron/gitoxide/issues/384), [#386](https://github.com/Byron/gitoxide/issues/386), [#691](https://github.com/Byron/gitoxide/issues/691) + +### Thanks Clippy + +<csr-read-only-do-not-edit/> + +[Clippy](https://github.com/rust-lang/rust-clippy) helped 3 times to make code idiomatic. + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **[#198](https://github.com/Byron/gitoxide/issues/198)** + - Adjust all changelogs to fulfil requirements for publishing ([`04b9ca0`](https://github.com/Byron/gitoxide/commit/04b9ca025a1667529b2221ab4280bd3c8dae01cf)) + - Deduplicate conventional message ids ([`e695eda`](https://github.com/Byron/gitoxide/commit/e695eda8cd183f703d9a3e59b7c3c7fa496ea1d2)) + - Regenerate all changelogs to get links ([`0c81769`](https://github.com/Byron/gitoxide/commit/0c817690bd444f52bed2936b2b451cafd87dde92)) + - Mention actual issues that where worked on ([`a517e39`](https://github.com/Byron/gitoxide/commit/a517e39a81145b331f6c7a6cc2fc22e25daf42e2)) + - Allow 'refactor' and 'other' in conventional messages if they have breaking changes ([`4eebaac`](https://github.com/Byron/gitoxide/commit/4eebaac669e590beed112b622752997c64772ef1)) + - Rebuild all changelogs to assure properly ordered headlines ([`4a9a05f`](https://github.com/Byron/gitoxide/commit/4a9a05f95930bad5938d4ce9c517ebf0e0b990f1)) + - Sort all commits by time, descending… ([`f536bad`](https://github.com/Byron/gitoxide/commit/f536bad20ffbac4dc353dfeb1a917bb88becbb78)) + - Greatly reduce changelog size now that the traversal fix is applied ([`a0bc98c`](https://github.com/Byron/gitoxide/commit/a0bc98c06c349de2fd6e0d4593606e68b98def72)) + - Fixup remaining changelogs… ([`2f75db2`](https://github.com/Byron/gitoxide/commit/2f75db294fcf20c325555822f65629611be52971)) + * **[#301](https://github.com/Byron/gitoxide/issues/301)** + - Update changelogs prior to release ([`84cb256`](https://github.com/Byron/gitoxide/commit/84cb25614a5fcddff297c1713eba4efbb6ff1596)) + - Refactor ([`287f47c`](https://github.com/Byron/gitoxide/commit/287f47c17a52be382f0866abaa0db6b33a09f560)) + * **[#364](https://github.com/Byron/gitoxide/issues/364)** + - Update changelogs prior to release ([`746a676`](https://github.com/Byron/gitoxide/commit/746a676056cd4907da7137a00798344b5bdb4419)) + * **[#384](https://github.com/Byron/gitoxide/issues/384)** + - Export git-tempfile in the root ([`a789490`](https://github.com/Byron/gitoxide/commit/a789490fbbba1f44d79d57c8ba74bf40c600faf2)) + * **[#386](https://github.com/Byron/gitoxide/issues/386)** + - Interpret `PermissionDenied` as reason to retry on lock acquisition failure. ([`73ecb40`](https://github.com/Byron/gitoxide/commit/73ecb40bb20f9c3fe7341f4ff1b0b81ac09b9ae0)) + * **[#691](https://github.com/Byron/gitoxide/issues/691)** + - Set `rust-version` to 1.64 ([`55066ce`](https://github.com/Byron/gitoxide/commit/55066ce5fd71209abb5d84da2998b903504584bb)) + * **Uncategorized** + - Release gix-attributes v0.8.2, gix-config-value v0.10.1, gix-tempfile v3.0.2, gix-lock v3.0.2, gix-validate v0.7.2, gix-object v0.26.1, gix-ref v0.24.0, gix-sec v0.6.2, gix-config v0.16.1, gix-command v0.2.3, gix-prompt v0.3.2, gix-url v0.13.2, gix-credentials v0.9.1, gix-diff v0.26.1, gix-discover v0.13.0, gix-hashtable v0.1.1, gix-bitmap v0.2.1, gix-traverse v0.22.1, gix-index v0.12.3, gix-mailmap v0.9.2, gix-chunk v0.4.1, gix-pack v0.30.2, gix-odb v0.40.2, gix-packetline v0.14.2, gix-transport v0.25.4, gix-protocol v0.26.3, gix-revision v0.10.3, gix-refspec v0.7.2, gix-worktree v0.12.2, gix v0.36.0 ([`e313112`](https://github.com/Byron/gitoxide/commit/e31311257bd138b52042dea5fc40c3abab7f269b)) + - Release gix-features v0.26.4, gix-actor v0.17.1, gix-glob v0.5.3, gix-path v0.7.1, gix-quote v0.4.1, gix-attributes v0.8.2, gix-config-value v0.10.1, gix-tempfile v3.0.2, gix-lock v3.0.2, gix-validate v0.7.2, gix-object v0.26.1, gix-ref v0.24.0, gix-sec v0.6.2, gix-config v0.16.1, gix-command v0.2.3, gix-prompt v0.3.2, gix-url v0.13.2, gix-credentials v0.9.1, gix-diff v0.26.1, gix-discover v0.13.0, gix-hashtable v0.1.1, gix-bitmap v0.2.1, gix-traverse v0.22.1, gix-index v0.12.3, gix-mailmap v0.9.2, gix-chunk v0.4.1, gix-pack v0.30.2, gix-odb v0.40.2, gix-packetline v0.14.2, gix-transport v0.25.4, gix-protocol v0.26.3, gix-revision v0.10.3, gix-refspec v0.7.2, gix-worktree v0.12.2, gix v0.36.0 ([`6efd0d3`](https://github.com/Byron/gitoxide/commit/6efd0d31fbeca31ab7319aa2ac97bb31dc4ce055)) + - Release gix-date v0.4.2, gix-hash v0.10.2, gix-features v0.26.4, gix-actor v0.17.1, gix-glob v0.5.3, gix-path v0.7.1, gix-quote v0.4.1, gix-attributes v0.8.2, gix-config-value v0.10.1, gix-tempfile v3.0.2, gix-lock v3.0.2, gix-validate v0.7.2, gix-object v0.26.1, gix-ref v0.24.0, gix-sec v0.6.2, gix-config v0.16.1, gix-command v0.2.3, gix-prompt v0.3.2, gix-url v0.13.2, gix-credentials v0.9.1, gix-diff v0.26.1, gix-discover v0.13.0, gix-hashtable v0.1.1, gix-bitmap v0.2.1, gix-traverse v0.22.1, gix-index v0.12.3, gix-mailmap v0.9.2, gix-chunk v0.4.1, gix-pack v0.30.2, gix-odb v0.40.2, gix-packetline v0.14.2, gix-transport v0.25.4, gix-protocol v0.26.3, gix-revision v0.10.3, gix-refspec v0.7.2, gix-worktree v0.12.2, gix v0.36.0 ([`6ccc88a`](https://github.com/Byron/gitoxide/commit/6ccc88a8e4a56973b1a358cf72dc012ee3c75d56)) + - Merge branch 'rename-crates' into inform-about-gix-rename ([`c9275b9`](https://github.com/Byron/gitoxide/commit/c9275b99ea43949306d93775d9d78c98fb86cfb1)) + - Adjust to renaming of `git-pack` to `gix-pack` ([`1ee81ad`](https://github.com/Byron/gitoxide/commit/1ee81ad310285ee4aa118118a2be3810dbace574)) + - Adjust to renaming of `git-odb` to `gix-odb` ([`476e2ad`](https://github.com/Byron/gitoxide/commit/476e2ad1a64e9e3f0d7c8651d5bcbee36cd78241)) + - Adjust to renaming of `git-index` to `gix-index` ([`86db5e0`](https://github.com/Byron/gitoxide/commit/86db5e09fc58ce66b252dc13b8d7e2c48e4d5062)) + - Adjust to renaming of `git-diff` to `gix-diff` ([`49a163e`](https://github.com/Byron/gitoxide/commit/49a163ec8b18f0e5fcd05a315de16d5d8be7650e)) + - Adjust to renaming of `git-commitgraph` to `gix-commitgraph` ([`f1dd0a3`](https://github.com/Byron/gitoxide/commit/f1dd0a3366e31259af029da73228e8af2f414244)) + - Adjust to renaming of `git-mailmap` to `gix-mailmap` ([`2e28c56`](https://github.com/Byron/gitoxide/commit/2e28c56bb9f70de6f97439818118d3a25859698f)) + - Adjust to renaming of `git-discover` to `gix-discover` ([`53adfe1`](https://github.com/Byron/gitoxide/commit/53adfe1c34e9ea3b27067a97b5e7ac80b351c441)) + - Adjust to renaming of `git-chunk` to `gix-chunk` ([`59194e3`](https://github.com/Byron/gitoxide/commit/59194e3a07853eae0624ebc4907478d1de4f7599)) + - Adjust to renaming of `git-bitmap` to `gix-bitmap` ([`75f2a07`](https://github.com/Byron/gitoxide/commit/75f2a079b17489f62bc43e1f1d932307375c4f9d)) + - Adjust to renaming for `git-protocol` to `gix-protocol` ([`823795a`](https://github.com/Byron/gitoxide/commit/823795addea3810243cab7936cd8ec0137cbc224)) + - Adjust to renaming of `git-refspec` to `gix-refspec` ([`c958802`](https://github.com/Byron/gitoxide/commit/c9588020561577736faa065e7e5b5bb486ca8fe1)) + - Adjust to renaming of `git-revision` to `gix-revision` ([`ee0ee84`](https://github.com/Byron/gitoxide/commit/ee0ee84607c2ffe11ee75f27a31903db68afed02)) + - Adjust to renaming of `git-transport` to `gix-transport` ([`b2ccf71`](https://github.com/Byron/gitoxide/commit/b2ccf716dc4425bb96651d4d58806a3cc2da219e)) + - Adjust to renaming of `git-credentials` to `gix-credentials` ([`6b18abc`](https://github.com/Byron/gitoxide/commit/6b18abcf2856f02ab938d535a65e51ac282bf94a)) + - Adjust to renaming of `git-prompt` to `gix-prompt` ([`6a4654e`](https://github.com/Byron/gitoxide/commit/6a4654e0d10ab773dd219cb4b731c0fc1471c36d)) + - Adjust to renaming of `git-command` to `gix-command` ([`d26b8e0`](https://github.com/Byron/gitoxide/commit/d26b8e046496894ae06b0bbfdba77196976cd975)) + - Adjust to renaming of `git-packetline` to `gix-packetline` ([`5cbd22c`](https://github.com/Byron/gitoxide/commit/5cbd22cf42efb760058561c6c3bbcd4dab8c8be1)) + - Adjust to renaming of `git-worktree` to `gix-worktree` ([`73a1282`](https://github.com/Byron/gitoxide/commit/73a12821b3d9b66ec1714d07dd27eb7a73e3a544)) + - Adjust to renamining of `git-worktree` to `gix-worktree` ([`108bb1a`](https://github.com/Byron/gitoxide/commit/108bb1a634f4828853fb590e9fc125f79441dd38)) + - Adjust to renaming of `git-url` to `gix-url` ([`b50817a`](https://github.com/Byron/gitoxide/commit/b50817aadb143e19f61f64e19b19ec1107d980c6)) + - Adjust to renaming of `git-date` to `gix-date` ([`9a79ff2`](https://github.com/Byron/gitoxide/commit/9a79ff2d5cc74c1efad9f41e21095ae498cce00b)) + - Adjust to renamining of `git-attributes` to `gix-attributes` ([`4a8b3b8`](https://github.com/Byron/gitoxide/commit/4a8b3b812ac26f2a2aee8ce8ca81591273383c84)) + - Adjust to renaminig of `git-quote` to `gix-quote` ([`648025b`](https://github.com/Byron/gitoxide/commit/648025b7ca94411fdd0d90c53e5faede5fde6c8d)) + - Adjust to renaming of `git-config` to `gix-config` ([`3a861c8`](https://github.com/Byron/gitoxide/commit/3a861c8f049f6502d3bcbdac752659aa1aeda46a)) + - Adjust to renaming of `git-ref` to `gix-ref` ([`1f5f695`](https://github.com/Byron/gitoxide/commit/1f5f695407b034377d94b172465ff573562b3fc3)) + - Adjust to renaming of `git-lock` to `gix-lock` ([`2028e78`](https://github.com/Byron/gitoxide/commit/2028e7884ae1821edeec81612f501e88e4722b17)) + - Rename `git-lock` to `gix-lock` ([`0422433`](https://github.com/Byron/gitoxide/commit/04224336b910fbcb8c32ef61edb345c53e945425)) + - Adjust to renaming of `git-tempfile` to `gix-tempfile` ([`b6cc3eb`](https://github.com/Byron/gitoxide/commit/b6cc3ebb5137084a6327af16a7d9364d8f092cc9)) + - Adjust to renaming of `git-object` to `gix-object` ([`fc86a1e`](https://github.com/Byron/gitoxide/commit/fc86a1e710ad7bf076c25cc6f028ddcf1a5a4311)) + - Adjust to renaming of `git-actor` to `gix-actor` ([`4dc9b44`](https://github.com/Byron/gitoxide/commit/4dc9b44dc52f2486ffa2040585c6897c1bf55df4)) + - Adjust to renaming of `git-validate` to `gix-validate` ([`5e40ad0`](https://github.com/Byron/gitoxide/commit/5e40ad078af3d08cbc2ca81ce755c0ed8a065b4f)) + - Adjust to renaming of `git-hash` to `gix-hash` ([`4a9d025`](https://github.com/Byron/gitoxide/commit/4a9d0257110c3efa61d08c8457c4545b200226d1)) + - Adjust to renaming of `git-features` to `gix-features` ([`e2dd68a`](https://github.com/Byron/gitoxide/commit/e2dd68a417aad229e194ff20dbbfd77668096ec6)) + - Adjust to renaming of `git-glob` to `gix-glob` ([`35b2a3a`](https://github.com/Byron/gitoxide/commit/35b2a3acbc8f2a03f151bc0a3863163844e0ca86)) + - Adjust to renaming of `git-sec` to `gix-sec` ([`eabbb92`](https://github.com/Byron/gitoxide/commit/eabbb923bd5a32fc80fa80f96cfdc2ab7bb2ed17)) + - Adapt to renaming of `git-path` to `gix-path` ([`d3bbcfc`](https://github.com/Byron/gitoxide/commit/d3bbcfccad80fc44ea8e7bf819f23adaca06ba2d)) + - Adjust to rename of `git-config-value` to `gix-config-value` ([`622b3e1`](https://github.com/Byron/gitoxide/commit/622b3e1d0bffa0f8db73697960f9712024fac430)) + - Release git-date v0.4.2, git-hash v0.10.2, git-features v0.26.2, git-actor v0.17.1, git-glob v0.5.3, git-path v0.7.1, git-quote v0.4.1, git-attributes v0.8.2, git-config-value v0.10.1, git-tempfile v3.0.2, git-lock v3.0.2, git-validate v0.7.2, git-object v0.26.1, git-ref v0.24.0, git-sec v0.6.2, git-config v0.16.0, git-command v0.2.3, git-prompt v0.3.2, git-url v0.13.2, git-credentials v0.9.1, git-diff v0.26.1, git-discover v0.13.0, git-hashtable v0.1.1, git-bitmap v0.2.1, git-traverse v0.22.1, git-index v0.12.3, git-mailmap v0.9.2, git-chunk v0.4.1, git-pack v0.30.2, git-odb v0.40.2, git-packetline v0.14.2, git-transport v0.25.4, git-protocol v0.26.3, git-revision v0.10.2, git-refspec v0.7.2, git-worktree v0.12.2, git-repository v0.34.0, safety bump 3 crates ([`c196d20`](https://github.com/Byron/gitoxide/commit/c196d206d57a310b1ce974a1cf0e7e6d6db5c4d6)) + - Prepare changelogs prior to release ([`7c846d2`](https://github.com/Byron/gitoxide/commit/7c846d2102dc767366771925212712ef8cc9bf07)) + - Merge branch 'Lioness100/main' ([`1e544e8`](https://github.com/Byron/gitoxide/commit/1e544e82455bf9ecb5e3c2146280eaf7ecd81f16)) + - Fix typos ([`39ed9ed`](https://github.com/Byron/gitoxide/commit/39ed9eda62b7718d5109135e5ad406fb1fe2978c)) + - Thanks clippy ([`bac57dd`](https://github.com/Byron/gitoxide/commit/bac57dd05ea2d5a4ee45ef9350fa3f2e19474bc0)) + - Release git-date v0.3.1, git-features v0.25.0, git-actor v0.15.0, git-glob v0.5.1, git-path v0.7.0, git-attributes v0.7.0, git-config-value v0.10.0, git-lock v3.0.1, git-validate v0.7.1, git-object v0.24.0, git-ref v0.21.0, git-sec v0.6.0, git-config v0.13.0, git-prompt v0.3.0, git-url v0.12.0, git-credentials v0.8.0, git-diff v0.24.0, git-discover v0.10.0, git-traverse v0.20.0, git-index v0.10.0, git-mailmap v0.7.0, git-pack v0.28.0, git-odb v0.38.0, git-packetline v0.14.1, git-transport v0.24.0, git-protocol v0.25.0, git-revision v0.8.0, git-refspec v0.5.0, git-worktree v0.10.0, git-repository v0.30.0, safety bump 26 crates ([`e6b9906`](https://github.com/Byron/gitoxide/commit/e6b9906c486b11057936da16ed6e0ec450a0fb83)) + - Prepare chnagelogs prior to git-repository release ([`7114bbb`](https://github.com/Byron/gitoxide/commit/7114bbb6732aa8571d4ab74f28ed3e26e9fbe4d0)) + - Merge branch 'main' into read-split-index ([`c57bdde`](https://github.com/Byron/gitoxide/commit/c57bdde6de37eca9672ea715962bbd02aa3eb055)) + - Merge branch 'adjustments-for-cargo' ([`083909b`](https://github.com/Byron/gitoxide/commit/083909bc7eb902eeee2002034fdb6ed88280dc5c)) + - Thanks clippy ([`f1160fb`](https://github.com/Byron/gitoxide/commit/f1160fb42acf59b37cbeda546a7079af3c9bc050)) + - Merge branch 'main' into http-config ([`bcd9654`](https://github.com/Byron/gitoxide/commit/bcd9654e56169799eb706646da6ee1f4ef2021a9)) + - Release git-hash v0.10.0, git-features v0.24.0, git-date v0.3.0, git-actor v0.14.0, git-glob v0.5.0, git-path v0.6.0, git-quote v0.4.0, git-attributes v0.6.0, git-config-value v0.9.0, git-tempfile v3.0.0, git-lock v3.0.0, git-validate v0.7.0, git-object v0.23.0, git-ref v0.20.0, git-sec v0.5.0, git-config v0.12.0, git-command v0.2.0, git-prompt v0.2.0, git-url v0.11.0, git-credentials v0.7.0, git-diff v0.23.0, git-discover v0.9.0, git-bitmap v0.2.0, git-traverse v0.19.0, git-index v0.9.0, git-mailmap v0.6.0, git-chunk v0.4.0, git-pack v0.27.0, git-odb v0.37.0, git-packetline v0.14.0, git-transport v0.23.0, git-protocol v0.24.0, git-revision v0.7.0, git-refspec v0.4.0, git-worktree v0.9.0, git-repository v0.29.0, git-commitgraph v0.11.0, gitoxide-core v0.21.0, gitoxide v0.19.0, safety bump 28 crates ([`b2c301e`](https://github.com/Byron/gitoxide/commit/b2c301ef131ffe1871314e19f387cf10a8d2ac16)) + - Prepare changelogs prior to release ([`e4648f8`](https://github.com/Byron/gitoxide/commit/e4648f827c97e9d13636d1bbdc83dd63436e6e5c)) + - Merge branch 'version2021' ([`0e4462d`](https://github.com/Byron/gitoxide/commit/0e4462df7a5166fe85c23a779462cdca8ee013e8)) + - Upgrade edition to 2021 in most crates. ([`3d8fa8f`](https://github.com/Byron/gitoxide/commit/3d8fa8fef9800b1576beab8a5bc39b821157a5ed)) + - Release git-glob v0.4.2, git-config-value v0.8.2, git-lock v2.2.0, git-ref v0.19.0, git-config v0.11.0, git-discover v0.8.0, git-index v0.8.0, git-transport v0.22.0, git-protocol v0.23.0, git-worktree v0.8.0, git-repository v0.28.0, gitoxide-core v0.20.0, gitoxide v0.18.0, safety bump 9 crates ([`0c253b1`](https://github.com/Byron/gitoxide/commit/0c253b15143dcedfe4c66d64ab1ea6e097030651)) + - Prepare changelogs prior to release ([`fe5721f`](https://github.com/Byron/gitoxide/commit/fe5721f888c64c79fe9a734a9e33b94a282f8d97)) + - Merge branch 'main' into http-config ([`f4ff821`](https://github.com/Byron/gitoxide/commit/f4ff821fd4233dd1dc1a449af4d4600becf3b4ac)) + - Merge branch 'async-fetch' ([`0c9c48b`](https://github.com/Byron/gitoxide/commit/0c9c48b3b91a1396eb1796f288a2cb10380d1f14)) + - Add `backoff` for an exponential backoff iterator. ([`f9bb71b`](https://github.com/Byron/gitoxide/commit/f9bb71b984045a069f7caf0c650ef24bd3cc0be1)) + - Merge branch 'main' into index-from-tree ([`bc64b96`](https://github.com/Byron/gitoxide/commit/bc64b96a2ec781c72d1d4daad38aa7fb8b74f99b)) + - Merge branch 'main' into filter-refs-by-spec ([`cfa1440`](https://github.com/Byron/gitoxide/commit/cfa144031dbcac2707ab0cec012bc35e78f9c475)) + - Release git-date v0.0.5, git-hash v0.9.8, git-features v0.22.2, git-actor v0.11.3, git-glob v0.3.2, git-quote v0.2.1, git-attributes v0.3.2, git-tempfile v2.0.4, git-lock v2.1.1, git-validate v0.5.5, git-object v0.20.2, git-ref v0.15.2, git-sec v0.3.1, git-config v0.7.0, git-credentials v0.4.0, git-diff v0.17.2, git-discover v0.4.1, git-bitmap v0.1.2, git-index v0.4.2, git-mailmap v0.3.2, git-chunk v0.3.1, git-traverse v0.16.2, git-pack v0.21.2, git-odb v0.31.2, git-packetline v0.12.7, git-url v0.7.2, git-transport v0.19.2, git-protocol v0.19.0, git-revision v0.4.2, git-refspec v0.1.0, git-worktree v0.4.2, git-repository v0.22.0, safety bump 4 crates ([`4974eca`](https://github.com/Byron/gitoxide/commit/4974eca96d525d1ee4f8cad79bb713af7a18bf9d)) + - Merge branch 'main' into remote-ls-refs ([`e2ee3de`](https://github.com/Byron/gitoxide/commit/e2ee3ded97e5c449933712883535b30d151c7c78)) + - Merge branch 'docsrs-show-features' ([`31c2351`](https://github.com/Byron/gitoxide/commit/31c235140cad212d16a56195763fbddd971d87ce)) + - Uniformize deny attributes ([`f7f136d`](https://github.com/Byron/gitoxide/commit/f7f136dbe4f86e7dee1d54835c420ec07c96cd78)) + - Remove default link to cargo doc everywhere ([`533e887`](https://github.com/Byron/gitoxide/commit/533e887e80c5f7ede8392884562e1c5ba56fb9a8)) + - Merge pull request #1 from Byron/main ([`085e76b`](https://github.com/Byron/gitoxide/commit/085e76b121291ed9bd324139105d2bd4117bedf8)) + - Merge branch 'main' into SidneyDouw-pathspec ([`a22b1d8`](https://github.com/Byron/gitoxide/commit/a22b1d88a21311d44509018729c3ef1936cf052a)) + - Merge branch 'main' into git_includeif ([`598c853`](https://github.com/Byron/gitoxide/commit/598c853087fcf8f77299aa5b9803bcec705c0cd0)) + - Release git-hash v0.9.4, git-features v0.21.0, git-actor v0.10.0, git-glob v0.3.0, git-path v0.1.1, git-attributes v0.1.0, git-sec v0.1.0, git-config v0.3.0, git-credentials v0.1.0, git-validate v0.5.4, git-object v0.19.0, git-diff v0.16.0, git-lock v2.1.0, git-ref v0.13.0, git-discover v0.1.0, git-index v0.3.0, git-mailmap v0.2.0, git-traverse v0.15.0, git-pack v0.19.0, git-odb v0.29.0, git-packetline v0.12.5, git-url v0.5.0, git-transport v0.17.0, git-protocol v0.16.0, git-revision v0.2.0, git-worktree v0.2.0, git-repository v0.17.0, safety bump 20 crates ([`654cf39`](https://github.com/Byron/gitoxide/commit/654cf39c92d5aa4c8d542a6cadf13d4acef6a78e)) + - Merge branch 'refs-and-worktrees' ([`8131227`](https://github.com/Byron/gitoxide/commit/8131227ddff6f36919b6a0f7b33792ebde0f8ae9)) + - Merge branch 'main' into git_includeif ([`05eb340`](https://github.com/Byron/gitoxide/commit/05eb34023933918c51c03cf2afd774db89cc5a33)) + - Merge branch 'main' into msrv-for-windows ([`7cb1972`](https://github.com/Byron/gitoxide/commit/7cb19729133325bdfacedf44cdc0500cbcf36684)) + - Make fmt ([`251b6df`](https://github.com/Byron/gitoxide/commit/251b6df5dbdda24b7bdc452085f808f3acef69d8)) + - Merge branch 'main' into git-sec ([`2fe70f9`](https://github.com/Byron/gitoxide/commit/2fe70f96cfb68e108637ce78f8edda2eb4e2e61a)) + - Merge branch 'main' into repo-status ([`8122c5c`](https://github.com/Byron/gitoxide/commit/8122c5c8a122e5297832f96c07a6fb1a5df02620)) + - Merge branch 'main' into repo-status ([`0eb2372`](https://github.com/Byron/gitoxide/commit/0eb23721dca78f6e6bf864c5c3a3e44df8b419f0)) + - Merge branch 'test-archive-support' ([`350df01`](https://github.com/Byron/gitoxide/commit/350df01042d6ca8b93f8737fa101e69b50535a0f)) + - Release git-diff v0.14.0, git-bitmap v0.1.0, git-index v0.2.0, git-tempfile v2.0.1, git-lock v2.0.0, git-mailmap v0.1.0, git-traverse v0.13.0, git-pack v0.17.0, git-quote v0.2.0, git-odb v0.27.0, git-packetline v0.12.4, git-url v0.4.0, git-transport v0.16.0, git-protocol v0.15.0, git-ref v0.12.0, git-worktree v0.1.0, git-repository v0.15.0, cargo-smart-release v0.9.0, safety bump 5 crates ([`e58dc30`](https://github.com/Byron/gitoxide/commit/e58dc3084cf17a9f618ae3a6554a7323e44428bf)) + - Release git-tempfile v2.0.0, safety bump 6 crates ([`90b1c42`](https://github.com/Byron/gitoxide/commit/90b1c42d5487904a9f329362d185b035d0ddb975)) + - Release git-hash v0.7.0, git-features v0.16.5, git-actor v0.5.3, git-config v0.1.7, git-validate v0.5.3, git-object v0.14.1, git-diff v0.10.0, git-tempfile v1.0.3, git-lock v1.0.1, git-traverse v0.9.0, git-pack v0.12.0, git-odb v0.22.0, git-packetline v0.11.0, git-url v0.3.4, git-transport v0.12.0, git-protocol v0.11.0, git-ref v0.8.0, git-repository v0.10.0, cargo-smart-release v0.4.0 ([`59ffbd9`](https://github.com/Byron/gitoxide/commit/59ffbd9f15583c8248b7f48b3f55ec6faffe7cfe)) + - Adjusting changelogs prior to release of git-hash v0.7.0, git-features v0.16.5, git-actor v0.5.3, git-validate v0.5.3, git-object v0.14.1, git-diff v0.10.0, git-tempfile v1.0.3, git-lock v1.0.1, git-traverse v0.9.0, git-pack v0.12.0, git-odb v0.22.0, git-packetline v0.11.0, git-url v0.3.4, git-transport v0.12.0, git-protocol v0.11.0, git-ref v0.8.0, git-repository v0.10.0, cargo-smart-release v0.4.0, safety bump 3 crates ([`a474395`](https://github.com/Byron/gitoxide/commit/a47439590e36b1cb8b516b6053fd5cbfc42efed7)) + - Update changelogs just for fun ([`21541b3`](https://github.com/Byron/gitoxide/commit/21541b3301de1e053fc0e84373be60d2162fbaae)) + - Release git-lock v1.0.0 ([`f38f72c`](https://github.com/Byron/gitoxide/commit/f38f72c73f69775358d8b047de2e354364fcafc2)) + - Release git-tempfile v1.0.0 ([`1238535`](https://github.com/Byron/gitoxide/commit/123853539dc30ddea2d822ab177ee09b191bdf1b)) + - [stability #171] prepare git-lock and git-tempfile release ([`3a1cf4d`](https://github.com/Byron/gitoxide/commit/3a1cf4d441b53c880b5c887916302a493ad28b41)) + - [stability #171] Prime git-tempfile and git-lock for release ([`01278fe`](https://github.com/Byron/gitoxide/commit/01278fe4e28bf97ce6a2b8947198683646e361ee)) + - Release git-lock v0.3.2 ([`a5ea2e7`](https://github.com/Byron/gitoxide/commit/a5ea2e7ba4bac484fad0672811ecd303214d8425)) + - Apply nightly rustfmt rules. ([`5e0edba`](https://github.com/Byron/gitoxide/commit/5e0edbadb39673d4de640f112fa306349fb11814)) + - (cargo-release) version 0.3.1 ([`168f5a0`](https://github.com/Byron/gitoxide/commit/168f5a0c5e9fdaf56789c884853569c5b850d7fa)) + - [lock #154] add io impls for `File` ([`be62a8b`](https://github.com/Byron/gitoxide/commit/be62a8bbe6c643017816ea23f15f04d38eb98b46)) + - (cargo-release) version 0.3.0 ([`263088b`](https://github.com/Byron/gitoxide/commit/263088b3faaccd9edae8c21dfc7d39b191d76207)) + - (cargo-release) version 0.6.0 ([`d58f37e`](https://github.com/Byron/gitoxide/commit/d58f37e3b5a000fbe069aa869bd84f66d5c3210b)) + - (cargo-release) version 0.2.0 ([`20d8e27`](https://github.com/Byron/gitoxide/commit/20d8e27dd4e93ae2234a3fe19b5f1511365eee2e)) + - (cargo-release) version 0.5.0 ([`0e11e98`](https://github.com/Byron/gitoxide/commit/0e11e98f0562c7baa9c90e18db6240731d165217)) + - Bump fastrand from 1.4.1 to 1.5.0 ([`b138b43`](https://github.com/Byron/gitoxide/commit/b138b437b9fb57f5df8bd582ac288ffac00df8cd)) + - [ref] fix docs ([`536555d`](https://github.com/Byron/gitoxide/commit/536555d66705175d83ba411392b049c8ed736ee9)) + - [ref] fix build ([`b4dcdfc`](https://github.com/Byron/gitoxide/commit/b4dcdfc9b2f2edcbcf9fb144d1f97e9a841463ad)) + - [lock] support recoverable commits ([`b2217e7`](https://github.com/Byron/gitoxide/commit/b2217e7d25df9801354f702b0625d3168f8d3271)) + - [lock] refactor ([`48861b2`](https://github.com/Byron/gitoxide/commit/48861b23406bbeee33081b32b2a528533997910d)) + - [lock] FAIL: trying to make peristence recoverable… ([`1fcdd1e`](https://github.com/Byron/gitoxide/commit/1fcdd1e5da51fe8f15e9bfab86b22a82ef936bcc)) + - [ref] try fix windows, once again ([`95e74dd`](https://github.com/Byron/gitoxide/commit/95e74dd9f1510fd288f281beea3f560319ad323d)) + - [lock] access to the locked resource path ([`797bafa`](https://github.com/Byron/gitoxide/commit/797bafaa0a83449be2acb647f875a67476548afe)) + - [lock] allow accessing the lock file path more easily ([`b808b00`](https://github.com/Byron/gitoxide/commit/b808b00f62f587679ffbfe9e465b33419cdd5879)) + - [lock] Fix handling of .lock extension on files without extension ([`64ac60d`](https://github.com/Byron/gitoxide/commit/64ac60d82db9bd81ceed2f0f1167c196de340ffe)) + - [lock] close file lock and commit markers ([`f700821`](https://github.com/Byron/gitoxide/commit/f7008214497d3a80ffcd62840854f3db65c563a9)) + - [lock] Marker commit with runtime check for protection ([`b747814`](https://github.com/Byron/gitoxide/commit/b74781403716e5156dad06ecf5cf83ff72262161)) + - (cargo-release) version 0.1.0 ([`60d48b0`](https://github.com/Byron/gitoxide/commit/60d48b0d008ca3b8612fd7b7e70b89b4bdb52b2c)) + - (cargo-release) version 0.4.0 ([`4512798`](https://github.com/Byron/gitoxide/commit/45127986daba0a409f5b405d463fa23f5c4a053b)) + - [lock] capture amount of attempts taken when obtaining a lock ([`7fafa3e`](https://github.com/Byron/gitoxide/commit/7fafa3e70a26c040e2f50c477df314eccf90a42f)) + - [lock] validate error message when waiting for some tim ([`34d3c5a`](https://github.com/Byron/gitoxide/commit/34d3c5a357c33e6734714cbbe8f6065b59f1215e)) + - [lock] the first test for lock failure (immediate mode) ([`2d67a0e`](https://github.com/Byron/gitoxide/commit/2d67a0e3948e717df0cc4de58686f5efa3645be9)) + - [lock] add [must_use = "reason"] attribute where it matters ([`813c46b`](https://github.com/Byron/gitoxide/commit/813c46b1ac9ed5454c7832a6bad5a112f145b565)) + - Thanks clippy ([`29782e8`](https://github.com/Byron/gitoxide/commit/29782e8c32d0b062e33a77bd4d639438e88b91b4)) + - [lock] lock acquire with backoff, but without test for now ([`bb2ba81`](https://github.com/Byron/gitoxide/commit/bb2ba81b2723cca11b4d98efa176ce5d184ab594)) + - [lock] prevent flakyness due to rounding or something ([`6f8fbcc`](https://github.com/Byron/gitoxide/commit/6f8fbcc197446068b680ea4c41e79bfc6356fcff)) + - [lock] refactor ([`ddc2170`](https://github.com/Byron/gitoxide/commit/ddc2170498d3822ebf6fc35e2e4b336f7af6d9f3)) + - [lock] remaining test for everything proper exponential backoff needs ([`368d994`](https://github.com/Byron/gitoxide/commit/368d9944b2b3379b0d01be93aea02cae25d1c867)) + - [lock] support for randomization ([`220eb99`](https://github.com/Byron/gitoxide/commit/220eb9945b2006f79b82d80eaabd09b5e291953b)) + - [lock] better overshoot test for exponential backoff ([`62c17d8`](https://github.com/Byron/gitoxide/commit/62c17d8721a8d797fe7475ea36a90931e835ebc4)) + - [lock] a sketch of exponential backoff, without rnadomization ([`55670b4`](https://github.com/Byron/gitoxide/commit/55670b458d248f6249f0031ec73c5eb4f72e36f7)) + - [lock] refactor, remaining docs ([`956e69f`](https://github.com/Byron/gitoxide/commit/956e69fcb96085d96124b6c56d829607b36adf9f)) + - [lock] tests green ([`3706b26`](https://github.com/Byron/gitoxide/commit/3706b2669ebee5cd25a75a42d9b0a4a380707ee1)) + - [lock] creation of lockfiles, with immediate failure mode ([`fda7da8`](https://github.com/Byron/gitoxide/commit/fda7da8ec43f7999effdfd76791a6541f8c52338)) + - [lock] first tests and a lot of refactoring ([`3c34194`](https://github.com/Byron/gitoxide/commit/3c34194b6c0fd5ab22eb91081a563ba3bfa19110)) + - [lock] even more sketched out API ([`0dc88c9`](https://github.com/Byron/gitoxide/commit/0dc88c9c42690a3e8320fe5b701c51eed8747118)) + - [lock] refactor; Marker is definitely not necessary… ([`6af84c9`](https://github.com/Byron/gitoxide/commit/6af84c92dbe049068be795ef4870fd830baf5384)) + - [lock] test what happens if multiple tempfiles are created ([`17942c7`](https://github.com/Byron/gitoxide/commit/17942c7960f25ad1f8f7fb2c94f251d39bb03c6e)) + - [lock] sketch API ([`f0e1427`](https://github.com/Byron/gitoxide/commit/f0e142734c1b09e6c4175b3c1b232d886449e280)) + - (cargo-release) version 0.3.0 ([`92f3a83`](https://github.com/Byron/gitoxide/commit/92f3a830457766c88c68f8424828bfd9b5145f86)) + - (cargo-release) version 0.2.0 ([`7c2eb36`](https://github.com/Byron/gitoxide/commit/7c2eb36274d13646956ac850bee90abbbac91c5b)) + - [lock] frame for git-lock crate ([`e6bc87d`](https://github.com/Byron/gitoxide/commit/e6bc87d77f9b397b25694f58d347de2fc38bf71d)) +</details> + +## 3.0.1 (2022-12-19) + +A maintenance release without user-facing changes. + +## 3.0.0 (2022-11-21) + +### New Features (BREAKING) + + - <csr-id-3d8fa8fef9800b1576beab8a5bc39b821157a5ed/> upgrade edition to 2021 in most crates. + MSRV for this is 1.56, and we are now at 1.60 so should be compatible. + This isn't more than a patch release as it should break nobody + who is adhering to the MSRV, but let's be careful and mark it + breaking. + + Note that `gix-features` and `gix-pack` are still on edition 2018 + as they make use of a workaround to support (safe) mutable access + to non-overlapping entries in a slice which doesn't work anymore + in edition 2021. + +## 2.2.0 (2022-11-17) + +### New Features + + - <csr-id-f9bb71b984045a069f7caf0c650ef24bd3cc0be1/> add `backoff` for an exponential backoff iterator. + It's used for computing the backoff on the lock itself, but is certainly + useful in other occasions as well. + +## 2.1.1 (2022-08-24) + +<csr-id-f7f136dbe4f86e7dee1d54835c420ec07c96cd78/> +<csr-id-533e887e80c5f7ede8392884562e1c5ba56fb9a8/> + +### Chore + + - <csr-id-f7f136dbe4f86e7dee1d54835c420ec07c96cd78/> uniformize deny attributes + - <csr-id-533e887e80c5f7ede8392884562e1c5ba56fb9a8/> remove default link to cargo doc everywhere + +## 2.1.0 (2022-05-18) + +### New Features + + - <csr-id-a789490fbbba1f44d79d57c8ba74bf40c600faf2/> export gix-tempfile in the root + This allows access to signal handler setup for example, which can be + useful in some situations. + +### Bug Fixes + + - <csr-id-73ecb40bb20f9c3fe7341f4ff1b0b81ac09b9ae0/> Interpret `PermissionDenied` as reason to retry on lock acquisition failure. + Evidence from CI suggests that on windows 'AlreadyExists' isn't the + common error code. Instead, maybe due to racyness, it can also emit + PermissionDenied errors which we now handle specifically. + +## 2.0.0 (2022-04-03) + +A maintenance release due to mildly breaking changes in `gix-tempfile`. + +## v1.0.1 (2021-10-15) + +This release contains no functional changes, but a more useful changelog. + +## v1.0.0 (2021-08-25) + +- initial release + +## v0.3.2 (2021-08-17) + +## v0.3.1 (2021-08-11) + +## v0.3.0 (2021-08-11) + +## v0.2.0 (2021-08-10) + +## v0.1.0 (2021-06-23) + +## v0.0.0 (2021-06-17) + diff --git a/vendor/gix-lock/Cargo.toml b/vendor/gix-lock/Cargo.toml new file mode 100644 index 000000000..55e977458 --- /dev/null +++ b/vendor/gix-lock/Cargo.toml @@ -0,0 +1,44 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.64" +name = "gix-lock" +version = "4.0.0" +authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] +include = [ + "src/**/*", + "LICENSE-*", + "README.md", + "CHANGELOG.md", +] +description = "A git-style lock-file implementation" +readme = "README.md" +license = "MIT/Apache-2.0" +repository = "https://github.com/Byron/gitoxide" + +[lib] +test = true +doctest = false + +[dependencies.fastrand] +version = "1.5.0" + +[dependencies.gix-tempfile] +version = "^4.0.0" +default-features = false + +[dependencies.thiserror] +version = "1.0.38" + +[dev-dependencies.tempfile] +version = "3.2.0" diff --git a/vendor/gix-lock/LICENSE-APACHE b/vendor/gix-lock/LICENSE-APACHE new file mode 100644 index 000000000..a51f59a06 --- /dev/null +++ b/vendor/gix-lock/LICENSE-APACHE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2018-2021 Sebastian Thiel, and [contributors](https://github.com/byron/gitoxide/contributors) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/gix-lock/LICENSE-MIT b/vendor/gix-lock/LICENSE-MIT new file mode 100644 index 000000000..b58e818f1 --- /dev/null +++ b/vendor/gix-lock/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018-2021 Sebastian Thiel, and [contributors](https://github.com/byron/gitoxide/contributors). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/gix-lock/README.md b/vendor/gix-lock/README.md new file mode 100644 index 000000000..436b918ef --- /dev/null +++ b/vendor/gix-lock/README.md @@ -0,0 +1,5 @@ +Use lock-files in the way git does with auto-cleanup being the most notable feature. + +* [x] writable lock files that can be committed to atomically replace the resource they lock +* [x] read-only markers that lock a resource without the intend to overwrite it +* [x] auto-removal of the lockfiles and intermediate directories on drop or on signal diff --git a/vendor/gix-lock/src/acquire.rs b/vendor/gix-lock/src/acquire.rs new file mode 100644 index 000000000..93655a7da --- /dev/null +++ b/vendor/gix-lock/src/acquire.rs @@ -0,0 +1,168 @@ +use std::{ + fmt, + path::{Path, PathBuf}, + time::Duration, +}; + +use gix_tempfile::{AutoRemove, ContainingDirectory}; + +use crate::{backoff, File, Marker, DOT_LOCK_SUFFIX}; + +/// Describe what to do if a lock cannot be obtained as it's already held elsewhere. +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +pub enum Fail { + /// Fail after the first unsuccessful attempt of obtaining a lock. + Immediately, + /// Retry after failure with exponentially longer sleep times to block the current thread. + /// Fail once the given duration is exceeded, similar to [Fail::Immediately] + AfterDurationWithBackoff(Duration), +} + +impl Default for Fail { + fn default() -> Self { + Fail::Immediately + } +} + +impl fmt::Display for Fail { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Fail::Immediately => f.write_str("immediately"), + Fail::AfterDurationWithBackoff(duration) => { + write!(f, "after {:.02}s", duration.as_secs_f32()) + } + } + } +} + +/// The error returned when acquiring a [`File`] or [`Marker`]. +#[derive(Debug, thiserror::Error)] +#[allow(missing_docs)] +pub enum Error { + #[error("Another IO error occurred while obtaining the lock")] + Io(#[from] std::io::Error), + #[error("The lock for resource '{resource_path}' could not be obtained {mode} after {attempts} attempt(s). The lockfile at '{resource_path}{}' might need manual deletion.", super::DOT_LOCK_SUFFIX)] + PermanentlyLocked { + resource_path: PathBuf, + mode: Fail, + attempts: usize, + }, +} + +impl File { + /// Create a writable lock file with failure `mode` whose content will eventually overwrite the given resource `at_path`. + /// + /// If `boundary_directory` is given, non-existing directories will be created automatically and removed in the case of + /// a rollback. Otherwise the containing directory is expected to exist, even though the resource doesn't have to. + pub fn acquire_to_update_resource( + at_path: impl AsRef<Path>, + mode: Fail, + boundary_directory: Option<PathBuf>, + ) -> Result<File, Error> { + let (lock_path, handle) = lock_with_mode(at_path.as_ref(), mode, boundary_directory, |p, d, c| { + gix_tempfile::writable_at(p, d, c) + })?; + Ok(File { + inner: handle, + lock_path, + }) + } +} + +impl Marker { + /// Like [`acquire_to_update_resource()`][File::acquire_to_update_resource()] but _without_ the possibility to make changes + /// and commit them. + /// + /// If `boundary_directory` is given, non-existing directories will be created automatically and removed in the case of + /// a rollback. + pub fn acquire_to_hold_resource( + at_path: impl AsRef<Path>, + mode: Fail, + boundary_directory: Option<PathBuf>, + ) -> Result<Marker, Error> { + let (lock_path, handle) = lock_with_mode(at_path.as_ref(), mode, boundary_directory, |p, d, c| { + gix_tempfile::mark_at(p, d, c) + })?; + Ok(Marker { + created_from_file: false, + inner: handle, + lock_path, + }) + } +} + +fn dir_cleanup(boundary: Option<PathBuf>) -> (ContainingDirectory, AutoRemove) { + match boundary { + None => (ContainingDirectory::Exists, AutoRemove::Tempfile), + Some(boundary_directory) => ( + ContainingDirectory::CreateAllRaceProof(Default::default()), + AutoRemove::TempfileAndEmptyParentDirectoriesUntil { boundary_directory }, + ), + } +} + +fn lock_with_mode<T>( + resource: &Path, + mode: Fail, + boundary_directory: Option<PathBuf>, + try_lock: impl Fn(&Path, ContainingDirectory, AutoRemove) -> std::io::Result<T>, +) -> Result<(PathBuf, T), Error> { + use std::io::ErrorKind::*; + let (directory, cleanup) = dir_cleanup(boundary_directory); + let lock_path = add_lock_suffix(resource); + let mut attempts = 1; + match mode { + Fail::Immediately => try_lock(&lock_path, directory, cleanup), + Fail::AfterDurationWithBackoff(time) => { + for wait in backoff::Exponential::default_with_random().until_no_remaining(time) { + attempts += 1; + match try_lock(&lock_path, directory, cleanup.clone()) { + Ok(v) => return Ok((lock_path, v)), + #[cfg(windows)] + Err(err) if err.kind() == AlreadyExists || err.kind() == PermissionDenied => { + std::thread::sleep(wait); + continue; + } + #[cfg(not(windows))] + Err(err) if err.kind() == AlreadyExists => { + std::thread::sleep(wait); + continue; + } + Err(err) => return Err(Error::from(err)), + } + } + try_lock(&lock_path, directory, cleanup) + } + } + .map(|v| (lock_path, v)) + .map_err(|err| match err.kind() { + AlreadyExists => Error::PermanentlyLocked { + resource_path: resource.into(), + mode, + attempts, + }, + _ => Error::Io(err), + }) +} + +fn add_lock_suffix(resource_path: &Path) -> PathBuf { + resource_path.with_extension(resource_path.extension().map_or_else( + || DOT_LOCK_SUFFIX.chars().skip(1).collect(), + |ext| format!("{}{}", ext.to_string_lossy(), DOT_LOCK_SUFFIX), + )) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn add_lock_suffix_to_file_with_extension() { + assert_eq!(add_lock_suffix(Path::new("hello.ext")), Path::new("hello.ext.lock")); + } + + #[test] + fn add_lock_suffix_to_file_without_extension() { + assert_eq!(add_lock_suffix(Path::new("hello")), Path::new("hello.lock")); + } +} diff --git a/vendor/gix-lock/src/backoff.rs b/vendor/gix-lock/src/backoff.rs new file mode 100644 index 000000000..f1c3559a6 --- /dev/null +++ b/vendor/gix-lock/src/backoff.rs @@ -0,0 +1,142 @@ +use std::time::Duration; + +fn randomize(backoff_ms: usize) -> usize { + let new_value = (fastrand::usize(750..=1250) * backoff_ms) / 1000; + if new_value == 0 { + backoff_ms + } else { + new_value + } +} + +/// A utility to calculate steps for exponential backoff similar to how it's done in `git`. +pub struct Exponential<Fn> { + multiplier: usize, + max_multiplier: usize, + exponent: usize, + transform: Fn, +} + +impl Default for Exponential<fn(usize) -> usize> { + fn default() -> Self { + Exponential { + multiplier: 1, + max_multiplier: 1000, + exponent: 1, + transform: std::convert::identity, + } + } +} + +impl Exponential<fn(usize) -> usize> { + /// Create a new exponential backoff iterator that backs off in randomized, ever increasing steps. + pub fn default_with_random() -> Self { + Exponential { + multiplier: 1, + max_multiplier: 1000, + exponent: 1, + transform: randomize, + } + } +} + +impl<Transform> Exponential<Transform> +where + Transform: Fn(usize) -> usize, +{ + /// Return an iterator that yields `Duration` instances to sleep on until `time` is depleted. + pub fn until_no_remaining(&mut self, time: Duration) -> impl Iterator<Item = Duration> + '_ { + let mut elapsed = Duration::default(); + let mut stop_next_iteration = false; + self.take_while(move |d| { + if stop_next_iteration { + false + } else { + elapsed += *d; + if elapsed > time { + stop_next_iteration = true; + } + true + } + }) + } +} + +impl<Transform> Iterator for Exponential<Transform> +where + Transform: Fn(usize) -> usize, +{ + type Item = Duration; + + fn next(&mut self) -> Option<Self::Item> { + let wait = Duration::from_millis((self.transform)(self.multiplier) as u64); + + self.multiplier += 2 * self.exponent + 1; + if self.multiplier > self.max_multiplier { + self.multiplier = self.max_multiplier; + } else { + self.exponent += 1; + } + Some(wait) + } +} + +#[cfg(test)] +mod tests { + use std::convert::TryInto; + + use super::*; + + const EXPECTED_TILL_SECOND: &[usize] = &[ + 1usize, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, + 576, 625, 676, 729, 784, 841, 900, 961, 1000, 1000, + ]; + + #[test] + fn random_exponential_produces_values_in_the_correct_range() { + let mut num_identities = 0; + for (actual, expected) in Exponential::default_with_random().zip(EXPECTED_TILL_SECOND) { + let actual: usize = actual.as_millis().try_into().unwrap(); + if actual == *expected { + num_identities += 1; + } + assert!( + actual * 1000 >= (expected - 1) * 750, + "value too small: {actual} < {expected}" + ); + assert!( + actual * 1000 <= (expected + 1) * 1250, + "value too big: {actual} > {expected}" + ); + } + assert!( + num_identities < EXPECTED_TILL_SECOND.len(), + "too many untransformed values: {num_identities}" + ); + } + + #[test] + fn how_many_iterations_for_a_second_of_waittime() { + let max = Duration::from_millis(1000); + assert_eq!(Exponential::default().until_no_remaining(max).count(), 14); + assert_eq!( + Exponential::default() + .until_no_remaining(max) + .reduce(|acc, n| acc + n) + .unwrap(), + Duration::from_millis(1015), + "a little overshoot" + ); + } + + #[test] + fn output_with_default_settings() { + assert_eq!( + Exponential::default().take(33).collect::<Vec<_>>(), + EXPECTED_TILL_SECOND + .iter() + .map(|n| Duration::from_millis(*n as u64)) + .collect::<Vec<_>>() + ); + } +} diff --git a/vendor/gix-lock/src/commit.rs b/vendor/gix-lock/src/commit.rs new file mode 100644 index 000000000..49b2595b2 --- /dev/null +++ b/vendor/gix-lock/src/commit.rs @@ -0,0 +1,79 @@ +use std::path::PathBuf; + +use crate::{File, Marker}; + +mod error { + use std::{ + fmt, + fmt::{Debug, Display}, + }; + + /// The error returned by various [`commit(…)`][super::Marker::commit()] methods + #[derive(Debug)] + pub struct Error<T: Debug> { + /// The io error that prevented the attempt to succeed + pub error: std::io::Error, + /// The marker or file which was used in the attempt to persist it + pub instance: T, + } + + impl<T: Debug> Display for Error<T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + Display::fmt(&self.error, f) + } + } + + impl<T: Debug> std::error::Error for Error<T> { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + self.error.source() + } + } +} +pub use error::Error; + +impl Marker { + /// Commit the changes written to the previously open file and overwrite the original file atomically, returning the resource path + /// on success. + /// + /// This fails for markers which weren't created with [`File::close()`] + pub fn commit(mut self) -> Result<PathBuf, Error<Self>> { + if !self.created_from_file { + return Err(Error { + error: std::io::Error::new( + std::io::ErrorKind::Other, + "refusing to commit marker that was never opened", + ), + instance: self, + }); + } + let resource_path = self.resource_path(); + match self.inner.persist(&resource_path) { + Ok(_) => Ok(resource_path), + Err(err) => Err(Error { + error: err.error, + instance: { + self.inner = err.handle; + self + }, + }), + } + } +} + +impl File { + /// Commit the changes written to this lock file and overwrite the original file atomically, returning the resource path + /// and an open file handle on success. + pub fn commit(mut self) -> Result<(PathBuf, Option<std::fs::File>), Error<Self>> { + let resource_path = self.resource_path(); + match self.inner.persist(&resource_path) { + Ok(possibly_file) => Ok((resource_path, possibly_file)), + Err(err) => Err(Error { + error: err.error, + instance: { + self.inner = err.handle; + self + }, + }), + } + } +} diff --git a/vendor/gix-lock/src/file.rs b/vendor/gix-lock/src/file.rs new file mode 100644 index 000000000..ad9a6db06 --- /dev/null +++ b/vendor/gix-lock/src/file.rs @@ -0,0 +1,78 @@ +use std::path::{Path, PathBuf}; + +use crate::{File, Marker, DOT_LOCK_SUFFIX}; + +fn strip_lock_suffix(lock_path: &Path) -> PathBuf { + let ext = lock_path + .extension() + .expect("at least our own extension") + .to_str() + .expect("no illegal UTF8 in extension"); + lock_path.with_extension(ext.split_at(ext.len().saturating_sub(DOT_LOCK_SUFFIX.len())).0) +} + +impl File { + /// Obtain a mutable reference to the write handle and call `f(out)` with it. + pub fn with_mut<T>(&mut self, f: impl FnOnce(&mut std::fs::File) -> std::io::Result<T>) -> std::io::Result<T> { + self.inner.with_mut(|tf| f(tf.as_file_mut())).and_then(|res| res) + } + /// Close the lock file to prevent further writes and to save system resources. + /// A call to [Marker::commit()] is allowed on the [`Marker`] to write changes back to the resource. + pub fn close(self) -> std::io::Result<Marker> { + Ok(Marker { + inner: self.inner.close()?, + created_from_file: true, + lock_path: self.lock_path, + }) + } + + /// Return the path at which the lock file resides + pub fn lock_path(&self) -> &Path { + &self.lock_path + } + + /// Return the path at which the locked resource resides + pub fn resource_path(&self) -> PathBuf { + strip_lock_suffix(&self.lock_path) + } +} + +mod io_impls { + use std::{io, io::SeekFrom}; + + use super::File; + + impl io::Write for File { + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + self.inner.with_mut(|f| f.write(buf))? + } + + fn flush(&mut self) -> io::Result<()> { + self.inner.with_mut(|f| f.flush())? + } + } + + impl io::Seek for File { + fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> { + self.inner.with_mut(|f| f.seek(pos))? + } + } + + impl io::Read for File { + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + self.inner.with_mut(|f| f.read(buf))? + } + } +} + +impl Marker { + /// Return the path at which the lock file resides + pub fn lock_path(&self) -> &Path { + &self.lock_path + } + + /// Return the path at which the locked resource resides + pub fn resource_path(&self) -> PathBuf { + strip_lock_suffix(&self.lock_path) + } +} diff --git a/vendor/gix-lock/src/lib.rs b/vendor/gix-lock/src/lib.rs new file mode 100644 index 000000000..882e15492 --- /dev/null +++ b/vendor/gix-lock/src/lib.rs @@ -0,0 +1,55 @@ +//! git-style registered lock files to make altering resources atomic. +//! +//! In this model, reads are always atomic and can be performed directly while writes are facilitated by a locking mechanism +//! implemented here. +//! +//! Lock files mostly `gix-tempfile` with its auto-cleanup and the following: +//! +//! * consistent naming of lock files +//! * block the thread (with timeout) or fail immediately if a lock cannot be obtained right away +//! * commit lock files to atomically put them into the location of the originally locked file +//! +//! # Limitations +//! +//! * As the lock file is separate from the actual resource, locking is merely a convention rather than being enforced. +//! * The limitations of `gix-tempfile` apply. +#![deny(missing_docs, rust_2018_idioms, unsafe_code)] + +use std::path::PathBuf; + +pub use gix_tempfile as tempfile; +use gix_tempfile::handle::{Closed, Writable}; + +const DOT_LOCK_SUFFIX: &str = ".lock"; + +/// +pub mod acquire; +/// +pub mod backoff; +/// +pub mod commit; + +/// Locks a resource to eventually be overwritten with the content of this file. +/// +/// Dropping the file without [committing][File::commit] will delete it, leaving the underlying resource unchanged. +#[must_use = "A File that is immediately dropped doesn't allow resource updates"] +#[derive(Debug)] +pub struct File { + inner: gix_tempfile::Handle<Writable>, + lock_path: PathBuf, +} + +/// Locks a resource to allow related resources to be updated using [files][File]. +/// +/// As opposed to the [File] type this one won't keep the tempfile open for writing and thus consumes no +/// system resources, nor can it be persisted. +#[must_use = "A Marker that is immediately dropped doesn't lock a resource meaningfully"] +#[derive(Debug)] +pub struct Marker { + inner: gix_tempfile::Handle<Closed>, + created_from_file: bool, + lock_path: PathBuf, +} + +/// +pub mod file; |