Skip to content

Add a lock interface for supporting advisory locks #5

@jwp

Description

@jwp

PostgreSQL's advisory locks offers users a handy tool.

Add a lock interface that is consistent with threading's Lock():

l = db.lock()
Creates a lock object with a generated identifier

il = db.lock('explicit_id')
Creates a lock object with an explicit identifier.
Will need to derive an numeric ID from the string.

From there, l and il must support the methods provided by Lock():

l.acquire([blocking = 1])
l.release()

Additionaly, CM interfaces:

with l:
...

Where l.enter is consistent with l.acquire(blocking = True).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions