flufl-lock


Nameflufl-lock JSON
Version 8.0.1 PyPI version JSON
download
home_page
SummaryNFS-safe file locking with timeouts for POSIX and Windows
upload_time2023-06-22 17:28:39
maintainer
docs_urlNone
author
requires_python>=3.8
licenseApache-2.0
keywords locking locks lock
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==========
flufl.lock
==========

NFS-safe file locking with timeouts for POSIX and Windows.

The ``flufl.lock`` library provides an NFS-safe file-based locking algorithm
influenced by the GNU/Linux ``open(2)`` manpage, under the description of the
``O_EXCL`` option.

    [...] O_EXCL is broken on NFS file systems, programs which rely on it
    for performing locking tasks will contain a race condition.  The
    solution for performing atomic file locking using a lockfile is to
    create a unique file on the same fs (e.g., incorporating hostname and
    pid), use link(2) to make a link to the lockfile.  If link() returns
    0, the lock is successful.  Otherwise, use stat(2) on the unique file
    to check if its link count has increased to 2, in which case the lock
    is also successful.

The assumption made here is that there will be no *outside interference*,
e.g. no agent external to this code will ever ``link()`` to the specific lock
files used.

Lock objects support lock-breaking so that you can't wedge a process forever.
This is especially helpful in a web environment, but may not be appropriate
for all applications.

Locks have a *lifetime*, which is the maximum length of time the process
expects to retain the lock.  It is important to pick a good number here
because other processes will not break an existing lock until the expected
lifetime has expired.  Too long and other processes will hang; too short and
you'll end up trampling on existing process locks -- and possibly corrupting
data.  In a distributed (NFS) environment, you also need to make sure that
your clocks are properly synchronized.


Author
======

``flufl.lock`` is Copyright (C) 2007-2023 Barry Warsaw <barry@python.org>

Licensed under the terms of the Apache License Version 2.0.  See the LICENSE
file for details.


Project details
===============

 * Project home: https://gitlab.com/warsaw/flufl.lock
 * Report bugs at: https://gitlab.com/warsaw/flufl.lock/issues
 * Code hosting: https://gitlab.com/warsaw/flufl.lock.git
 * Documentation: https://flufllock.readthedocs.io/
 * PyPI: https://pypi.python.org/pypi/flufl.lock

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "flufl-lock",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "locking locks lock",
    "author": "",
    "author_email": "Barry Warsaw <barry@python.org>",
    "download_url": "https://files.pythonhosted.org/packages/89/a5/b22002ee8f5bbe787f0fd0e895aa37281d64ff4a48ba2624743a3dc80083/flufl_lock-8.0.1.tar.gz",
    "platform": null,
    "description": "==========\nflufl.lock\n==========\n\nNFS-safe file locking with timeouts for POSIX and Windows.\n\nThe ``flufl.lock`` library provides an NFS-safe file-based locking algorithm\ninfluenced by the GNU/Linux ``open(2)`` manpage, under the description of the\n``O_EXCL`` option.\n\n    [...] O_EXCL is broken on NFS file systems, programs which rely on it\n    for performing locking tasks will contain a race condition.  The\n    solution for performing atomic file locking using a lockfile is to\n    create a unique file on the same fs (e.g., incorporating hostname and\n    pid), use link(2) to make a link to the lockfile.  If link() returns\n    0, the lock is successful.  Otherwise, use stat(2) on the unique file\n    to check if its link count has increased to 2, in which case the lock\n    is also successful.\n\nThe assumption made here is that there will be no *outside interference*,\ne.g. no agent external to this code will ever ``link()`` to the specific lock\nfiles used.\n\nLock objects support lock-breaking so that you can't wedge a process forever.\nThis is especially helpful in a web environment, but may not be appropriate\nfor all applications.\n\nLocks have a *lifetime*, which is the maximum length of time the process\nexpects to retain the lock.  It is important to pick a good number here\nbecause other processes will not break an existing lock until the expected\nlifetime has expired.  Too long and other processes will hang; too short and\nyou'll end up trampling on existing process locks -- and possibly corrupting\ndata.  In a distributed (NFS) environment, you also need to make sure that\nyour clocks are properly synchronized.\n\n\nAuthor\n======\n\n``flufl.lock`` is Copyright (C) 2007-2023 Barry Warsaw <barry@python.org>\n\nLicensed under the terms of the Apache License Version 2.0.  See the LICENSE\nfile for details.\n\n\nProject details\n===============\n\n * Project home: https://gitlab.com/warsaw/flufl.lock\n * Report bugs at: https://gitlab.com/warsaw/flufl.lock/issues\n * Code hosting: https://gitlab.com/warsaw/flufl.lock.git\n * Documentation: https://flufllock.readthedocs.io/\n * PyPI: https://pypi.python.org/pypi/flufl.lock\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "NFS-safe file locking with timeouts for POSIX and Windows",
    "version": "8.0.1",
    "project_urls": {
        "Bug tracker": "https://gitlab.com/warsaw/flufl.lock/issues",
        "Documentation": "https://flufllock.readthedocs.io",
        "Home page": "https://flufllock.readthedocs.io",
        "Source code": "https://gitlab.com/warsaw/flufl.lock.git"
    },
    "split_keywords": [
        "locking",
        "locks",
        "lock"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47f7f514703a47f8c8641d14cb751a1983fc45011d39b02e65830e573103c15a",
                "md5": "3773b3fba0c7309fc3ee2fb9ebaa5b91",
                "sha256": "a3df854d76173d59813fdcba91671234b59e2a14db3390793745c77a7bb92d9d"
            },
            "downloads": -1,
            "filename": "flufl_lock-8.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3773b3fba0c7309fc3ee2fb9ebaa5b91",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11146,
            "upload_time": "2023-06-22T17:28:38",
            "upload_time_iso_8601": "2023-06-22T17:28:38.344100Z",
            "url": "https://files.pythonhosted.org/packages/47/f7/f514703a47f8c8641d14cb751a1983fc45011d39b02e65830e573103c15a/flufl_lock-8.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89a5b22002ee8f5bbe787f0fd0e895aa37281d64ff4a48ba2624743a3dc80083",
                "md5": "3fbba382ea5bf48cfb3075f02df3aae4",
                "sha256": "edb7f1f3f8b4805ef6a6a23b9a3975bfc9b7c15eb33e10b0b086d0caa2a97e04"
            },
            "downloads": -1,
            "filename": "flufl_lock-8.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3fbba382ea5bf48cfb3075f02df3aae4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 34442,
            "upload_time": "2023-06-22T17:28:39",
            "upload_time_iso_8601": "2023-06-22T17:28:39.628445Z",
            "url": "https://files.pythonhosted.org/packages/89/a5/b22002ee8f5bbe787f0fd0e895aa37281d64ff4a48ba2624743a3dc80083/flufl_lock-8.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-22 17:28:39",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "warsaw",
    "gitlab_project": "flufl.lock",
    "lcname": "flufl-lock"
}
        
Elapsed time: 1.55937s