tba-bases-replay 0.4.0.dev2__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.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tba-bases-replay
|
|
3
|
+
Version: 0.4.0.dev2
|
|
4
|
+
Summary: Protocol-neutral replay reservation bases.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.10,<3.15
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Dist: tba-contracts-replay (==0.4.0.dev2)
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# tba-bases-replay
|
|
17
|
+
|
|
18
|
+
Shared protocol-neutral replay reservation behavior. Implementations must make
|
|
19
|
+
check-and-reserve atomic; the base does not select persistence or networking.
|
|
20
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tba-bases-replay"
|
|
3
|
+
version = "0.4.0.dev2"
|
|
4
|
+
description = "Protocol-neutral replay reservation bases."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10,<3.15"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
dependencies = ["tba-contracts-replay==0.4.0.dev2"]
|
|
9
|
+
|
|
10
|
+
[build-system]
|
|
11
|
+
requires = ["poetry-core>=1.0.0"]
|
|
12
|
+
build-backend = "poetry.core.masonry.api"
|
|
13
|
+
|
|
14
|
+
[tool.poetry]
|
|
15
|
+
packages = [{ include = "tba_bases_replay", from = "src" }]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Protocol-neutral replay reservation bases."""
|
|
2
|
+
|
|
3
|
+
from abc import ABC
|
|
4
|
+
from hashlib import sha256
|
|
5
|
+
|
|
6
|
+
from tba_contracts_replay import (
|
|
7
|
+
ReplayKey,
|
|
8
|
+
ReplayReservationPort,
|
|
9
|
+
ReplayReservationRequest,
|
|
10
|
+
ReplayReservationResult,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ReplayReservationBase(ReplayReservationPort, ABC):
|
|
15
|
+
provider_id = "replay:abstract"
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def digest_key(key: ReplayKey) -> str:
|
|
19
|
+
material = "\x1f".join(
|
|
20
|
+
(key.namespace, key.tenant_id or "", key.issuer or "", key.value)
|
|
21
|
+
).encode("utf-8")
|
|
22
|
+
return sha256(material).hexdigest()
|
|
23
|
+
|
|
24
|
+
async def check_and_reserve(
|
|
25
|
+
self, request: ReplayReservationRequest, /
|
|
26
|
+
) -> ReplayReservationResult:
|
|
27
|
+
raise NotImplementedError
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = ["ReplayReservationBase"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|