lockss-pybasic 0.3.0.dev12__py3-none-any.whl → 0.3.0.dev13__py3-none-any.whl
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.
- lockss/pybasic/__init__.py +1 -1
- lockss/pybasic/nodeutil.py +34 -7
- {lockss_pybasic-0.3.0.dev12.dist-info → lockss_pybasic-0.3.0.dev13.dist-info}/METADATA +2 -2
- lockss_pybasic-0.3.0.dev13.dist-info/RECORD +10 -0
- lockss_pybasic-0.3.0.dev12.dist-info/RECORD +0 -10
- {lockss_pybasic-0.3.0.dev12.dist-info → lockss_pybasic-0.3.0.dev13.dist-info}/WHEEL +0 -0
- {lockss_pybasic-0.3.0.dev12.dist-info → lockss_pybasic-0.3.0.dev13.dist-info}/licenses/LICENSE +0 -0
lockss/pybasic/__init__.py
CHANGED
lockss/pybasic/nodeutil.py
CHANGED
|
@@ -38,7 +38,7 @@ import re
|
|
|
38
38
|
from typing import Annotated, Any, ClassVar, Literal, Optional, TypeAlias, Union
|
|
39
39
|
|
|
40
40
|
from annotated_types import Ge, Le
|
|
41
|
-
from pydantic import BaseModel, BeforeValidator, Field, TypeAdapter
|
|
41
|
+
from pydantic import BaseModel, BeforeValidator, Field, TypeAdapter, model_validator
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
#: An annotated type for port numbers (0-65535)
|
|
@@ -47,10 +47,13 @@ PortNumber: TypeAlias = Annotated[int, Ge(0), Le(65535)]
|
|
|
47
47
|
|
|
48
48
|
class NodeTypeEnum(Enum):
|
|
49
49
|
"""An enumerated type representing LOCKSS node types."""
|
|
50
|
-
#: An enumerated constant representing LOCKSS 1.x
|
|
50
|
+
#: An enumerated constant representing a LOCKSS 1.x node.
|
|
51
51
|
V1 = 'v1'
|
|
52
|
-
#: An enumerated constant representing LOCKSS 2.x
|
|
52
|
+
#: An enumerated constant representing a LOCKSS 2.x node.
|
|
53
53
|
V2 = 'v2'
|
|
54
|
+
#: An enumerated constant representing a LOCKSS 1.x and 2.x node pair in
|
|
55
|
+
#: migration mode.
|
|
56
|
+
V1_V2_MIGRATION_PAIR = 'v1-v2-migration-pair'
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
class NodeProtocolEnum(Enum):
|
|
@@ -84,9 +87,6 @@ class BaseNodeSpec(BaseModel):
|
|
|
84
87
|
title='Protocol',
|
|
85
88
|
description="The protocol for reaching the node")
|
|
86
89
|
|
|
87
|
-
host: str = Field(title='Host',
|
|
88
|
-
description="The node's host")
|
|
89
|
-
|
|
90
90
|
|
|
91
91
|
class NodeSpec1(BaseNodeSpec):
|
|
92
92
|
|
|
@@ -94,10 +94,18 @@ class NodeSpec1(BaseNodeSpec):
|
|
|
94
94
|
|
|
95
95
|
type: Literal['v1'] = Field(**BaseNodeSpec.TYPE_FIELD)
|
|
96
96
|
|
|
97
|
+
host: str = Field(title='Host',
|
|
98
|
+
description="The node's host")
|
|
99
|
+
|
|
97
100
|
ui: PortNumber = Field(default=DEFAULT_UI_PORT_V1,
|
|
98
101
|
title='UI Port',
|
|
99
102
|
description="The LOCKSS 1.x node's Web user interface port")
|
|
100
103
|
|
|
104
|
+
@model_validator(mode='before')
|
|
105
|
+
@classmethod
|
|
106
|
+
def _parse_compact_node_spec(cls, data: Any) -> Any:
|
|
107
|
+
return _maybe_deserialize_compact_node_spec(data)
|
|
108
|
+
|
|
101
109
|
|
|
102
110
|
class NodeSpec2(BaseNodeSpec):
|
|
103
111
|
|
|
@@ -115,6 +123,9 @@ class NodeSpec2(BaseNodeSpec):
|
|
|
115
123
|
|
|
116
124
|
type: Literal['v2'] = Field(**BaseNodeSpec.TYPE_FIELD)
|
|
117
125
|
|
|
126
|
+
host: str = Field(title='Host',
|
|
127
|
+
description="The node's host")
|
|
128
|
+
|
|
118
129
|
repository: PortNumber = Field(default=DEFAULT_REPO_PORT,
|
|
119
130
|
title='Repository Port',
|
|
120
131
|
description="The node's Repository Service REST API Port")
|
|
@@ -139,6 +150,22 @@ class NodeSpec2(BaseNodeSpec):
|
|
|
139
150
|
title='SOAP Port',
|
|
140
151
|
description="The node's SOAP Compatibility Service REST API Port")
|
|
141
152
|
|
|
153
|
+
@model_validator(mode='before')
|
|
154
|
+
@classmethod
|
|
155
|
+
def _parse_compact_node_spec(cls, data: Any) -> Any:
|
|
156
|
+
return _maybe_deserialize_compact_node_spec(data)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class NodeSpec12Pair(BaseNodeSpec):
|
|
160
|
+
|
|
161
|
+
type: Literal['v1-v2-migration-pair'] = Field(**BaseNodeSpec.TYPE_FIELD)
|
|
162
|
+
|
|
163
|
+
origin: NodeSpec1 = Field(title='Origin',
|
|
164
|
+
description='The origin node (LOCKSS 1.x)')
|
|
165
|
+
|
|
166
|
+
destination: NodeSpec2 = Field(title='Destination',
|
|
167
|
+
description='The destination node (LOCKSS 2.x)')
|
|
168
|
+
|
|
142
169
|
|
|
143
170
|
_RE_COMPACT_NODE_SPEC: Pattern[str] = re.compile(r'((?P<protocol>https?)://)?(?P<host>[^:]+)(:(?P<repository>\d+|(?=:))(:(?P<configuration>\d+|(?=:))(:(?P<poller>\d+|(?=:))(:(?P<crawler>\d+|(?=:))(:(?P<metadata>\d+|(?=:))(:(?P<soap>\d+))?)?)?)?)?)?')
|
|
144
171
|
|
|
@@ -184,7 +211,7 @@ def _maybe_deserialize_compact_node_spec(value: Any) -> Any:
|
|
|
184
211
|
#: A type for LOCKSS node specifications, that also accepts a compact LOCKSS
|
|
185
212
|
#: node specification.
|
|
186
213
|
NodeSpec: TypeAlias = Annotated[
|
|
187
|
-
Annotated[Union[NodeSpec1, NodeSpec2], Field(discriminator='type')],
|
|
214
|
+
Annotated[Union[NodeSpec1, NodeSpec2, NodeSpec12Pair], Field(discriminator='type')],
|
|
188
215
|
BeforeValidator(_maybe_deserialize_compact_node_spec)
|
|
189
216
|
]
|
|
190
217
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lockss-pybasic
|
|
3
|
-
Version: 0.3.0.
|
|
3
|
+
Version: 0.3.0.dev13
|
|
4
4
|
Summary: Basic Python utilities
|
|
5
5
|
License: BSD-3-Clause
|
|
6
6
|
License-File: LICENSE
|
|
@@ -26,7 +26,7 @@ Description-Content-Type: text/x-rst
|
|
|
26
26
|
lockss-pybasic
|
|
27
27
|
==============
|
|
28
28
|
|
|
29
|
-
.. |RELEASE| replace:: 0.3.0-
|
|
29
|
+
.. |RELEASE| replace:: 0.3.0-dev13
|
|
30
30
|
|
|
31
31
|
.. |RELEASE_DATE| replace:: NOT YET RELEASED
|
|
32
32
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
lockss/pybasic/__init__.py,sha256=P7tODLAt_4QzJsvGrZ9Qyo2cV6816dwJBSJXG9azjO8,1679
|
|
2
|
+
lockss/pybasic/auidutil.py,sha256=Q4vjjGfymiXVwPu35RyyLZBnViv8mDJKCjOyJb-sbS8,13921
|
|
3
|
+
lockss/pybasic/cliutil.py,sha256=rKpodgt2oO9SHbwN1v13cMzg337YWT-iDzNM2SaUn7k,8221
|
|
4
|
+
lockss/pybasic/errorutil.py,sha256=4EaO0a1yIG1DbWltASeT15bg1bGg5kOYspsW0iJdVLc,1951
|
|
5
|
+
lockss/pybasic/fileutil.py,sha256=P_XW_UX6hVvP45vRV8fduclbGmoFflW83a6ZfFE-8Hc,2966
|
|
6
|
+
lockss/pybasic/nodeutil.py,sha256=qhZql5gNTEK-bLX_GPzEc95wVp-5bObWgBBE2Qpwv4k,9284
|
|
7
|
+
lockss_pybasic-0.3.0.dev13.dist-info/METADATA,sha256=2RqdcFhWIr_x0HL5Zozk3j5vBAXQPW-g21gduglVt8A,2495
|
|
8
|
+
lockss_pybasic-0.3.0.dev13.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
|
|
9
|
+
lockss_pybasic-0.3.0.dev13.dist-info/licenses/LICENSE,sha256=EOxPunNz3XP6AjgbPFolu-d9BS_AF9TtKn1WXgeYPsE,1506
|
|
10
|
+
lockss_pybasic-0.3.0.dev13.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
lockss/pybasic/__init__.py,sha256=OUJuXzOlzbjkZbYpkS3aSJMq_3eIDJU4Jejpy3q_pJk,1679
|
|
2
|
-
lockss/pybasic/auidutil.py,sha256=Q4vjjGfymiXVwPu35RyyLZBnViv8mDJKCjOyJb-sbS8,13921
|
|
3
|
-
lockss/pybasic/cliutil.py,sha256=rKpodgt2oO9SHbwN1v13cMzg337YWT-iDzNM2SaUn7k,8221
|
|
4
|
-
lockss/pybasic/errorutil.py,sha256=4EaO0a1yIG1DbWltASeT15bg1bGg5kOYspsW0iJdVLc,1951
|
|
5
|
-
lockss/pybasic/fileutil.py,sha256=P_XW_UX6hVvP45vRV8fduclbGmoFflW83a6ZfFE-8Hc,2966
|
|
6
|
-
lockss/pybasic/nodeutil.py,sha256=-MSCS79JMAgoja00lTs0ycHUbI5JJHvCCQMRXOyB-fc,8293
|
|
7
|
-
lockss_pybasic-0.3.0.dev12.dist-info/METADATA,sha256=kcyJf4uOVaGjFyowMi9rtWp2v9v4IwlD0g1KgPznyFY,2495
|
|
8
|
-
lockss_pybasic-0.3.0.dev12.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
|
|
9
|
-
lockss_pybasic-0.3.0.dev12.dist-info/licenses/LICENSE,sha256=EOxPunNz3XP6AjgbPFolu-d9BS_AF9TtKn1WXgeYPsE,1506
|
|
10
|
-
lockss_pybasic-0.3.0.dev12.dist-info/RECORD,,
|
|
File without changes
|
{lockss_pybasic-0.3.0.dev12.dist-info → lockss_pybasic-0.3.0.dev13.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|