harlowja / fasteners

A python package that provides useful locks.
Apache License 2.0
248 stars 45 forks source link

Allow for using and working with offset locks #10

Open harlowja opened 9 years ago

harlowja commented 9 years ago

Offset locks allow for lock inside a single file using byte offsets, this avoids having to create hundreds of lock files for each use case, and instead allows for an application to be smarter, and shard locks from a single file for its use-cases (assuming the file can pick a large enough file with enough offsets to satisfy its needs).

This makes it much easier to cleanup lock files, track them and know when to delete them (because deleting per-lock lock files is hard to do when an application is always online, because knowing when to delete a lock file is a non-trivial problem when an application has no interface to tell which locks are alive or dead and which are safe to delete).

rishi-freshbooks commented 7 years ago

We would find this feature very useful since we are looking to create many locks (i.e. a lock per id). Any chance this is ready?

harlowja commented 7 years ago

So currently I was looking at waiting for https://github.com/harlowja/fasteners/issues/26#issuecomment-253543912 (see comment here).

BoPeng commented 6 years ago

Is there any reason why this PR has not been merged? I visited this issue a year ago and I ended up using thousands of lock files in my project. I really need to address this problem now but the PR is still not merged.

harlowja commented 6 years ago

Only reason was I was waiting for someone to review :)

4383 commented 4 years ago

Hello,

I designed some pocs/tools to test these changes and to help other to review/test it.

Please find them here (https://github.com/4383/oslo.concurrency.lab).

For the moment this poc test these changes outside of the oslo scope (direct use of fasteners). 2 files are in use there:

You can a look to them for more details and infos.

Also for more infos on how to use this POC you can read the related doc:

Except my previous comment these changes look fine for the moment.

Now I will spend time to test this through the oslo scope and implement some related pocs.

4383 commented 4 years ago

Any feedbacks related to my previous messages?