Improve the lock interface to better suit distributed locks
Maintainers usually reply within 1 day
@Acconut is already working on this.
Since Apr 15, 2024.
Assessment
This issue has not been assessed yet.
Description
The current lock inferface was primarily inspired by in-memory mutexes, where one can assume that an acquired mutex is valid until it is released again. These assumption do not hold up for distributed lock mechanisms and we should adjust the lock interface to accommodate those:
- Distributed locks often provide leases instead of mutexes. A lease has a specific lifetime, after which it expires and the lease is available to be grabbed by another entity. If the owner wants to continue holding exclusive access they have to extend the lease. This ensures that when the owning process dies, the lease is not locked forever, but is released after a given fixed duration. This means that our new inferface should
- expose a method for extending the lease. This method is then regularly called by the tusd handler to ensure that the lease is extended while the request is being handled. This should be done by the request handler to ensure that the lease is not extended whenever the request handling is aborted or crashes.
- return a context that is valid as long as a valid lease is held. If we are not able to extend the lease, the context should be cancelled as we cannot ensure anymore that we have exclusive access and any access must be immediately interrupted.
- The lock interface incorporates a feature for requesting releases for locks. However, this naming is not entirely correct because it requests the controlled abortion of the handling of another request. The ending of that will then cause the lock to be released. On a technical level, we could separate the locking interface from this messaging interface to make the system more composable. We could even think about making the messaging system more capable if there are use cases where tusd instances should communicate with each other.
- Dominant language
- Go
- Stars
- 3.9k
- Forks
- 557
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 10
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tus/tusd
-
Upload-Concat partial URLs are not parsed as URLs (404 with -base-path / and with query strings)Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
handler: data race on `ctx.body`, and an interruption before the body is set up is lostMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
C Implementation?Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 8/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
projectcalico/calico#14766 ·
Maintainers usually reply within 1 day
-
forward/review service/container
Difficulty 1/5 Under an hour Newbie friendliness 86/100
hashicorp/terraform-provider-google#30852 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100