simplebroker-pg 3.2.0__tar.gz → 3.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/PKG-INFO +2 -2
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/pyproject.toml +3 -3
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/plugin.py +39 -39
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/schema.py +1 -2
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/.gitignore +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/LICENSE +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/README.md +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/__init__.py +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/_constants.py +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/_identifiers.py +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/_sql.py +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/py.typed +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/runner.py +0 -0
- {simplebroker_pg-3.2.0 → simplebroker_pg-3.2.2}/simplebroker_pg/validation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simplebroker-pg
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.2
|
|
4
4
|
Summary: Postgres backend plugin for SimpleBroker
|
|
5
5
|
Author-email: Van Lindberg <van.lindberg@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -8,7 +8,7 @@ License-File: LICENSE
|
|
|
8
8
|
Requires-Python: >=3.11
|
|
9
9
|
Requires-Dist: psycopg-pool>=3.1
|
|
10
10
|
Requires-Dist: psycopg[binary]>=3
|
|
11
|
-
Requires-Dist: simplebroker>=5.
|
|
11
|
+
Requires-Dist: simplebroker>=5.3.3
|
|
12
12
|
Provides-Extra: dev
|
|
13
13
|
Requires-Dist: pytest-timeout>=2.4.0; extra == 'dev'
|
|
14
14
|
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
2
|
+
requires = ["hatchling>=1.31,<2"]
|
|
3
3
|
build-backend = "hatchling.build"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "simplebroker-pg"
|
|
7
|
-
version = "3.2.
|
|
7
|
+
version = "3.2.2"
|
|
8
8
|
description = "Postgres backend plugin for SimpleBroker"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -14,7 +14,7 @@ authors = [
|
|
|
14
14
|
{name = "Van Lindberg", email = "van.lindberg@gmail.com"},
|
|
15
15
|
]
|
|
16
16
|
dependencies = [
|
|
17
|
-
"simplebroker>=5.
|
|
17
|
+
"simplebroker>=5.3.3",
|
|
18
18
|
"psycopg[binary]>=3",
|
|
19
19
|
"psycopg-pool>=3.1",
|
|
20
20
|
]
|
|
@@ -6,7 +6,7 @@ import threading
|
|
|
6
6
|
import warnings
|
|
7
7
|
from collections.abc import Callable, Mapping, Sequence
|
|
8
8
|
from dataclasses import dataclass
|
|
9
|
-
from typing import Any, Literal,
|
|
9
|
+
from typing import TYPE_CHECKING, Any, Literal, cast
|
|
10
10
|
from urllib.parse import quote
|
|
11
11
|
|
|
12
12
|
from psycopg import ProgrammingError, conninfo
|
|
@@ -39,43 +39,43 @@ from .validation import (
|
|
|
39
39
|
validate_target,
|
|
40
40
|
)
|
|
41
41
|
|
|
42
|
+
if TYPE_CHECKING:
|
|
43
|
+
from typing import Protocol
|
|
42
44
|
|
|
43
|
-
class _SchemaAwareRunner(SQLRunner, Protocol):
|
|
44
|
-
|
|
45
|
+
class _SchemaAwareRunner(SQLRunner, Protocol):
|
|
46
|
+
"""Runner protocol exposing the managed Postgres schema name."""
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
@property
|
|
49
|
+
def schema(self) -> str: ...
|
|
48
50
|
|
|
51
|
+
class _DsnAwareRunner(SQLRunner, Protocol):
|
|
52
|
+
"""Runner protocol exposing DSN details for activity waiters."""
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
@property
|
|
55
|
+
def dsn(self) -> str: ...
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
@property
|
|
58
|
+
def schema(self) -> str: ...
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
class _MetaCachingRunner(SQLRunner, Protocol):
|
|
61
|
+
"""Runner protocol exposing optional cached Postgres metadata."""
|
|
58
62
|
|
|
63
|
+
def get_meta_cache(self) -> RunnerMetaState | None: ...
|
|
59
64
|
|
|
60
|
-
|
|
61
|
-
"""Runner protocol exposing optional cached Postgres metadata."""
|
|
65
|
+
def prime_meta_cache(self, state: RunnerMetaState) -> None: ...
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
def update_meta_cache(
|
|
68
|
+
self,
|
|
69
|
+
*,
|
|
70
|
+
magic: str | None = None,
|
|
71
|
+
schema_version: int | None = None,
|
|
72
|
+
last_ts: int | None = None,
|
|
73
|
+
alias_version: int | None = None,
|
|
74
|
+
) -> None: ...
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
def invalidate_meta_cache(self) -> None: ...
|
|
66
77
|
|
|
67
|
-
|
|
68
|
-
self,
|
|
69
|
-
*,
|
|
70
|
-
magic: str | None = None,
|
|
71
|
-
schema_version: int | None = None,
|
|
72
|
-
last_ts: int | None = None,
|
|
73
|
-
alias_version: int | None = None,
|
|
74
|
-
) -> None: ...
|
|
75
|
-
|
|
76
|
-
def invalidate_meta_cache(self) -> None: ...
|
|
77
|
-
|
|
78
|
-
def is_schema_bootstrapped(self) -> bool: ...
|
|
78
|
+
def is_schema_bootstrapped(self) -> bool: ...
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
@dataclass(frozen=True, slots=True)
|
|
@@ -95,14 +95,14 @@ class VerifiedPostgresEnv:
|
|
|
95
95
|
def _cached_meta(runner: SQLRunner) -> RunnerMetaState | None:
|
|
96
96
|
getter = getattr(runner, "get_meta_cache", None)
|
|
97
97
|
if callable(getter):
|
|
98
|
-
return cast(_MetaCachingRunner, runner).get_meta_cache()
|
|
98
|
+
return cast("_MetaCachingRunner", runner).get_meta_cache()
|
|
99
99
|
return None
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
def _prime_meta(runner: SQLRunner, state: RunnerMetaState) -> None:
|
|
103
103
|
setter = getattr(runner, "prime_meta_cache", None)
|
|
104
104
|
if callable(setter):
|
|
105
|
-
cast(_MetaCachingRunner, runner).prime_meta_cache(state)
|
|
105
|
+
cast("_MetaCachingRunner", runner).prime_meta_cache(state)
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
def _update_meta(
|
|
@@ -115,7 +115,7 @@ def _update_meta(
|
|
|
115
115
|
) -> None:
|
|
116
116
|
updater = getattr(runner, "update_meta_cache", None)
|
|
117
117
|
if callable(updater):
|
|
118
|
-
cast(_MetaCachingRunner, runner).update_meta_cache(
|
|
118
|
+
cast("_MetaCachingRunner", runner).update_meta_cache(
|
|
119
119
|
magic=magic,
|
|
120
120
|
schema_version=schema_version,
|
|
121
121
|
last_ts=last_ts,
|
|
@@ -331,7 +331,7 @@ class PostgresBackendPlugin:
|
|
|
331
331
|
|
|
332
332
|
name = "postgres"
|
|
333
333
|
sql: BackendSQLNamespace = ensure_backend_sql_namespace(pg_sql)
|
|
334
|
-
backend_api_version =
|
|
334
|
+
backend_api_version = 3
|
|
335
335
|
schema_version = POSTGRES_SCHEMA_VERSION
|
|
336
336
|
|
|
337
337
|
def init_backend(
|
|
@@ -494,7 +494,7 @@ class PostgresBackendPlugin:
|
|
|
494
494
|
*,
|
|
495
495
|
run_with_retry: Callable[[Callable[[], Any]], Any],
|
|
496
496
|
) -> None:
|
|
497
|
-
schema_name = cast(_SchemaAwareRunner, runner).schema
|
|
497
|
+
schema_name = cast("_SchemaAwareRunner", runner).schema
|
|
498
498
|
initialize_database(
|
|
499
499
|
runner,
|
|
500
500
|
schema=schema_name,
|
|
@@ -691,7 +691,7 @@ class PostgresBackendPlugin:
|
|
|
691
691
|
]
|
|
692
692
|
|
|
693
693
|
def database_size_bytes(self, runner: SQLRunner) -> int:
|
|
694
|
-
schema_name = cast(_SchemaAwareRunner, runner).schema
|
|
694
|
+
schema_name = cast("_SchemaAwareRunner", runner).schema
|
|
695
695
|
rows = list(runner.run(pg_sql.DATABASE_SIZE_BYTES, (schema_name,), fetch=True))
|
|
696
696
|
return int(rows[0][0]) if rows else 0
|
|
697
697
|
|
|
@@ -735,7 +735,7 @@ class PostgresBackendPlugin:
|
|
|
735
735
|
runner.run(pg_sql.LOCK_BROADCAST_SCOPE)
|
|
736
736
|
|
|
737
737
|
def prepare_alias_mutation(self, runner: SQLRunner) -> None:
|
|
738
|
-
schema_name = cast(_SchemaAwareRunner, runner).schema
|
|
738
|
+
schema_name = cast("_SchemaAwareRunner", runner).schema
|
|
739
739
|
runner.run(
|
|
740
740
|
"SELECT pg_advisory_xact_lock(?)",
|
|
741
741
|
(stable_lock_key("aliases", schema_name),),
|
|
@@ -748,7 +748,7 @@ class PostgresBackendPlugin:
|
|
|
748
748
|
compact: bool,
|
|
749
749
|
config: Mapping[str, Any],
|
|
750
750
|
) -> None:
|
|
751
|
-
schema_name = cast(_SchemaAwareRunner, runner).schema
|
|
751
|
+
schema_name = cast("_SchemaAwareRunner", runner).schema
|
|
752
752
|
lock_key = stable_lock_key("vacuum", schema_name)
|
|
753
753
|
leased = lease_runner_thread_connection(runner)
|
|
754
754
|
try:
|
|
@@ -828,8 +828,8 @@ class PostgresBackendPlugin:
|
|
|
828
828
|
|
|
829
829
|
if runner is not None:
|
|
830
830
|
if not isinstance(runner, PostgresRunner):
|
|
831
|
-
dsn = cast(_DsnAwareRunner, runner).dsn
|
|
832
|
-
schema = cast(_DsnAwareRunner, runner).schema
|
|
831
|
+
dsn = cast("_DsnAwareRunner", runner).dsn
|
|
832
|
+
schema = cast("_DsnAwareRunner", runner).schema
|
|
833
833
|
else:
|
|
834
834
|
dsn = runner.dsn
|
|
835
835
|
schema = runner.schema
|
|
@@ -864,8 +864,8 @@ class PostgresBackendPlugin:
|
|
|
864
864
|
|
|
865
865
|
if runner is not None:
|
|
866
866
|
if not isinstance(runner, PostgresRunner):
|
|
867
|
-
dsn = cast(_DsnAwareRunner, runner).dsn
|
|
868
|
-
schema = cast(_DsnAwareRunner, runner).schema
|
|
867
|
+
dsn = cast("_DsnAwareRunner", runner).dsn
|
|
868
|
+
schema = cast("_DsnAwareRunner", runner).schema
|
|
869
869
|
else:
|
|
870
870
|
dsn = runner.dsn
|
|
871
871
|
schema = runner.schema
|
|
@@ -253,8 +253,7 @@ def migrate_schema(
|
|
|
253
253
|
if current_version < 4:
|
|
254
254
|
runner.run(CREATE_ALIASES_TABLE)
|
|
255
255
|
runner.run(CREATE_ALIAS_TARGET_INDEX)
|
|
256
|
-
|
|
257
|
-
runner.run(CREATE_QUEUE_TS_ORDER_UNCLAIMED_INDEX)
|
|
256
|
+
runner.run(CREATE_QUEUE_TS_ORDER_UNCLAIMED_INDEX)
|
|
258
257
|
|
|
259
258
|
write_schema_version(POSTGRES_SCHEMA_VERSION)
|
|
260
259
|
runner.commit()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|