Skip to main content

Hierarchical locks

Allows the caller to lock a "directory", or an individual file.

Locks are, by default, shared, recursive & timed.

First optional argument to the lock manager is the "sep".

Second optional argument is "flags" (default is HiLokFlags.RECURSIVE, can be also be HiLokFlags:STRICT).

from hilok import HiLok, HiLokError, HiLokFlags

h = HiLok()     # default sep is '/', can pass it in here

rd = h.read("/some/path")

# nonblocking, this will fail!
try:
    wr = h.write("/some", block=False)
except HiLokError:
    pass

rd.release()

wr = h.write("/some")

# timeout=0 is the the same as block=False
rd = h.read("/some/path", block=False)

# with syntax is fine:
with h.read("/some/path"):
    pass

Lock modes:

  • HiLokFlags.STRICT : not reentrant, the good mode
  • HiLokFlags.RECURSIVE : fully reentrant, supports escalation (read/write/release-read) and de-escalation (write/read/release-write)
  • HiLokFlags.RECURSIVE_WRITE : only write-locks are reentrant
  • HiLokFlags.RECURSIVE_ONEWAY : can read-lock while holding a write, but not vice-versa

Metadata

Release files for hilok 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for hilok 1.3.1
File
hilok-1.3.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
hilok-1.3.1-cp311-cp311-macosx_12_0_universal2.whl CPython 3.11 CPython 3.11 macOS 12.0+ universal2 (ARM64, x86-64) Details
hilok-1.3.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
hilok-1.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
hilok-1.3.1-cp310-cp310-macosx_12_0_x86_64.whl CPython 3.10 CPython 3.10 macOS 12.0+ x86-64 Details
hilok-1.3.1-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
hilok-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
hilok-1.3.1-cp39-cp39-macosx_10_15_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.15+ x86-64 Details

Total release size: 736.8 kB

Release files / hilok-1.3.1-cp311-cp311-win_amd64.whl

Download URL hilok-1.3.1-cp311-cp311-win_amd64.whl
Size 96.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
23f05706345c97f196ff9d6e602d092d11f9150e8a81be5c70c6a3d52d1501fa
BLAKE2b-256 checksum
How to use checksums
0203cb7a9182257e2aade9380e899f2a7c03bbbd4a18240b3b3034550d40e703
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / hilok-1.3.1-cp311-cp311-macosx_12_0_universal2.whl

Download URL hilok-1.3.1-cp311-cp311-macosx_12_0_universal2.whl
Size 80.2 kB
Tags CPython 3.11 macOS 12.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
fae94f06b7553e1faa530a6a28bc4d9ad838fcfbecf6cd16d6c64c1e35106a86
BLAKE2b-256 checksum
How to use checksums
54f79d1ef2610f86fa996015de3592612caeafc1e14bda0cfb443eaf628a5e1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / hilok-1.3.1-cp310-cp310-win_amd64.whl

Download URL hilok-1.3.1-cp310-cp310-win_amd64.whl
Size 96.0 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
77afd64c1bae2e783f9eaadaa0b36fdfe7a082f81013b3cb18428df5325146c0
BLAKE2b-256 checksum
How to use checksums
a01aa26494519d0b60ab564efb43d82bc096271fd19a732d3b0205b1255ca04a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / hilok-1.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hilok-1.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 102.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3d6ebe785f0e706103088f06ac6ddcf81708c7cb048782de48e4c2ffac739fc2
BLAKE2b-256 checksum
How to use checksums
3f0bb4c6870cdc4f4b8cd00fa5b9636ceacdc8d495aacafd9dd873f592d5284f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / hilok-1.3.1-cp310-cp310-macosx_12_0_x86_64.whl

Download URL hilok-1.3.1-cp310-cp310-macosx_12_0_x86_64.whl
Size 80.3 kB
Tags CPython 3.10 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
8d292227b42ee4efa9b63b772d458266b1faa23e81786997d229e92e19d633f9
BLAKE2b-256 checksum
How to use checksums
22169f7f9edba5e412b9e4466f0c9f96ba30d68e82b05416355343eda4e74063
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / hilok-1.3.1-cp39-cp39-win_amd64.whl

Download URL hilok-1.3.1-cp39-cp39-win_amd64.whl
Size 96.1 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
ffaa8607a9a9fe06f0f88eed3e81cb0aa06479e466140a91b00a08da483650aa
BLAKE2b-256 checksum
How to use checksums
08fd945c2c22c28412137372904b462d2fb4ea4146781d62b9da81bf9ef990bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / hilok-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hilok-1.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 102.5 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
40f8eec9b6e2b5791c8fd2a20a51f925cdacc419535471a53f0e9f830a35e5c7
BLAKE2b-256 checksum
How to use checksums
940ca45a3c1466bd0934d5e008bd58d584d37c8a91790bb88533e6101ef2d51a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / hilok-1.3.1-cp39-cp39-macosx_10_15_x86_64.whl

Download URL hilok-1.3.1-cp39-cp39-macosx_10_15_x86_64.whl
Size 83.3 kB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
988da12b687f762b56d231c19875639c8e7e2b438e43a2d73c7055e341f6f1c7
BLAKE2b-256 checksum
How to use checksums
c9e0ca8c52ac132044b9bc05ea38abcc29026d2c9bb097f88e1992d6c6fc155c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.14

Release history Release notifications | RSS feed

This release

1.3.1 This release

8 release files

1.3.0

8 release files

1.2.0

6 release files

1.1.0

6 release files

1.0.4

6 release files

1.0.3

6 release files

1.0.2

4 release files

1.0.1

1 release file

0.0.18

8 release files

0.0.7

2 release files

0.0.6

1 release file

0.0.5

2 release files

0.0.1

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page