hsync-common 1.0.2__tar.gz → 1.0.4__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.
Files changed (97) hide show
  1. {hsync_common-1.0.2 → hsync_common-1.0.4}/PKG-INFO +1 -1
  2. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/constants.py +1 -1
  3. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/bootnode.py +8 -8
  4. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/events.py +3 -0
  5. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/bootnode-register.json +1 -1
  6. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/bootnode-response.json +1 -1
  7. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-election-scenarios.json +18 -18
  8. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures.py +4 -4
  9. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/p2p/txt-schema.json +6 -6
  10. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/p2p.py +4 -4
  11. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/rest/openapi.json +1 -1
  12. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/schemas.py +2 -2
  13. {hsync_common-1.0.2 → hsync_common-1.0.4}/pyproject.toml +2 -2
  14. {hsync_common-1.0.2 → hsync_common-1.0.4}/LICENSE +0 -0
  15. {hsync_common-1.0.2 → hsync_common-1.0.4}/README.md +0 -0
  16. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/__init__.py +0 -0
  17. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/clock.py +0 -0
  18. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/compression.py +0 -0
  19. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/delta/__init__.py +0 -0
  20. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/delta/decision.py +0 -0
  21. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/delta/rolling_checksum.py +0 -0
  22. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/endpoint.py +0 -0
  23. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/env.py +0 -0
  24. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/exceptions.py +0 -0
  25. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/format.py +0 -0
  26. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/hashing.py +0 -0
  27. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/ignore.py +0 -0
  28. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/labels.py +0 -0
  29. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/logger.py +0 -0
  30. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/__init__.py +0 -0
  31. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/_store_base.py +0 -0
  32. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/_util.py +0 -0
  33. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/delta.py +0 -0
  34. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/dir.py +0 -0
  35. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/event.py +0 -0
  36. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/file.py +0 -0
  37. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/folder.py +0 -0
  38. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/sqlstore.py +0 -0
  39. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/symlink.py +0 -0
  40. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/sync_action.py +0 -0
  41. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/tombstone.py +0 -0
  42. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/tombstone_store.py +0 -0
  43. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/version.py +0 -0
  44. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/models/version_store.py +0 -0
  45. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/path_validation.py +0 -0
  46. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/permissions.py +0 -0
  47. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/__init__.py +0 -0
  48. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/capabilities.py +0 -0
  49. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/bootnode-ack.json +0 -0
  50. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/bootnode-fingerprint.json +0 -0
  51. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/bootnode-query.json +0 -0
  52. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/causal-resolution-scenarios.json +0 -0
  53. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/causal-tombstone-scenarios.json +0 -0
  54. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/delta-apply-metadata.json +0 -0
  55. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/delta-instructions.json +0 -0
  56. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/delta-signatures.json +0 -0
  57. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ntp-targets-scenarios.json +0 -0
  58. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-bootnode-trust-scenarios.json +0 -0
  59. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-pairing-scenarios.json +0 -0
  60. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-sources-request.json +0 -0
  61. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-sources-response.json +0 -0
  62. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-txt-record.json +0 -0
  63. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-txt-seeder-record.json +0 -0
  64. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-auth-failed.json +0 -0
  65. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-auth-ok.json +0 -0
  66. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-auth-required.json +0 -0
  67. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-auth.json +0 -0
  68. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-hello-master.json +0 -0
  69. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-hello-slave.json +0 -0
  70. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-inventory-ack-ok.json +0 -0
  71. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-inventory-ack-rejected.json +0 -0
  72. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-inventory-ack-resync.json +0 -0
  73. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-inventory-delta-delete.json +0 -0
  74. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-inventory-delta-upsert.json +0 -0
  75. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-inventory-empty-snapshot.json +0 -0
  76. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/p2p-wss-inventory-snapshot.json +0 -0
  77. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ws-auth-error.json +0 -0
  78. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ws-auth-ok.json +0 -0
  79. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ws-auth-request.json +0 -0
  80. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ws-file-event.json +0 -0
  81. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ws-ping.json +0 -0
  82. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ws-pong.json +0 -0
  83. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/fixtures/ws-presence.json +0 -0
  84. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/handshake.py +0 -0
  85. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/p2p/sources-schema.json +0 -0
  86. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/p2p/wss-schema.json +0 -0
  87. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/pairing.py +0 -0
  88. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/peer_download.py +0 -0
  89. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/rest.py +0 -0
  90. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/tls_trust.py +0 -0
  91. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/protocol/ws/ws-schema.json +0 -0
  92. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/ratelimit.py +0 -0
  93. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/runtime.py +0 -0
  94. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/ssl_utils.py +0 -0
  95. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/text.py +0 -0
  96. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/time_utils.py +0 -0
  97. {hsync_common-1.0.2 → hsync_common-1.0.4}/hsync_common/upnp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hsync-common
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: HSYNC Common - shared models, constants, and compression utilities
5
5
  License-Expression: BSD-3-Clause
6
6
  License-File: LICENSE
@@ -18,7 +18,7 @@ from typing import Final, Literal
18
18
  # Single source of truth for the HSYNC application version, shared by client,
19
19
  # server, desktop and Android. The wire-protocol versions live separately in
20
20
  # hsync_common.protocol.handshake (PROTOCOL_VERSION_*).
21
- HSYNC_VERSION = "1.0.2"
21
+ HSYNC_VERSION = "1.0.4"
22
22
 
23
23
  # =============================================================================
24
24
  # HTTP Headers (wire protocol)
@@ -21,7 +21,7 @@ malformed fields without partially accepting them (the same strictness the
21
21
  bootnode's ``extra="forbid"`` models provide).
22
22
 
23
23
  Besides the advisory ``capacity`` hint, ``register`` and ``peers[]`` carry the
24
- **election advertisement** (``server_ready``/``force_master``/``never_master``/
24
+ **election advertisement** (``server_ready``/``prefer_master``/``never_master``/
25
25
  ``startup_time``/``sync_direction``) — the same values the mDNS TXT record
26
26
  carries, relayed verbatim by the bootnode so both discovery plans feed the one
27
27
  shared election algorithm in :mod:`hsync_common.protocol.p2p`. The bootnode never
@@ -192,7 +192,7 @@ class BootRegister(TypedDict):
192
192
  (``0`` = not a seeder). The bootnode relays it in ``query`` responses; the
193
193
  authoritative value is the authenticated ``serve_slots`` (ADR-0030).
194
194
 
195
- ``server_ready``/``force_master``/``never_master``/``startup_time``/
195
+ ``server_ready``/``prefer_master``/``never_master``/``startup_time``/
196
196
  ``sync_direction`` are the **election advertisement**, the same values the
197
197
  mDNS TXT record carries. The bootnode relays them verbatim in ``query``
198
198
  responses so a bootnode-discovered peer ranks exactly like an mDNS one; it
@@ -214,7 +214,7 @@ class BootRegister(TypedDict):
214
214
  bucket_token: NotRequired[str]
215
215
  connected: NotRequired[int]
216
216
  server_ready: NotRequired[bool]
217
- force_master: NotRequired[bool]
217
+ prefer_master: NotRequired[bool]
218
218
  never_master: NotRequired[bool]
219
219
  startup_time: NotRequired[float]
220
220
  sync_direction: NotRequired[str]
@@ -279,7 +279,7 @@ class BootPeer(TypedDict):
279
279
 
280
280
  The election-advertisement fields are relayed verbatim from the peer's
281
281
  ``register`` (defaults when it advertised none): ``server_ready`` (it is
282
- currently serving as master), ``force_master``/``never_master`` (operator
282
+ currently serving as master), ``prefer_master``/``never_master`` (operator
283
283
  pins), ``startup_time`` (unix seconds, ``0.0`` = unknown) and
284
284
  ``sync_direction``. They feed the shared election algorithm exactly like
285
285
  the mDNS TXT values; none of them is authenticated.
@@ -293,7 +293,7 @@ class BootPeer(TypedDict):
293
293
  capacity: int
294
294
  reachable: bool
295
295
  server_ready: bool
296
- force_master: bool
296
+ prefer_master: bool
297
297
  never_master: bool
298
298
  startup_time: float
299
299
  sync_direction: str
@@ -326,7 +326,7 @@ _REGISTER_OPTIONAL = frozenset(
326
326
  "capacity",
327
327
  "endpoints",
328
328
  "server_ready",
329
- "force_master",
329
+ "prefer_master",
330
330
  "never_master",
331
331
  "startup_time",
332
332
  "sync_direction",
@@ -352,7 +352,7 @@ _PEER_REQUIRED = frozenset(
352
352
  "capacity",
353
353
  "reachable",
354
354
  "server_ready",
355
- "force_master",
355
+ "prefer_master",
356
356
  "never_master",
357
357
  "startup_time",
358
358
  "sync_direction",
@@ -480,7 +480,7 @@ def _read_election_advert(value: Mapping, clean: dict, *, optional: bool) -> boo
480
480
  ``peers[]`` side (every key is required, the bootnode always relays them).
481
481
  Returns False on any malformed value so the caller rejects the whole frame.
482
482
  """
483
- for key in ("server_ready", "force_master", "never_master"):
483
+ for key in ("server_ready", "prefer_master", "never_master"):
484
484
  if key not in value:
485
485
  if optional:
486
486
  clean[key] = False
@@ -114,6 +114,9 @@ class UiEventDict(TypedDict):
114
114
  conflict_copy: NotRequired[str] # path of the preserved local copy (conflict_resolved)
115
115
  winner: NotRequired[str] # which side won: "remote" (master) or "local"
116
116
  source_cid: NotRequired[str] # verified peer source for a successful full-file transfer
117
+ reason: NotRequired[str] # sync_paused: human-readable guard reason
118
+ deletes: NotRequired[int] # sync_paused: deletions blocked this cycle
119
+ local: NotRequired[int] # sync_paused: local files considered by the guard
117
120
  plan: NotRequired[str] # discovery event: "mdns" | "mdns+bootnode"
118
121
  bootnode: NotRequired[str] # discovery event: bootnode host (empty without one)
119
122
 
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "connected": 3,
14
14
  "server_ready": true,
15
- "force_master": false,
15
+ "prefer_master": false,
16
16
  "never_master": false,
17
17
  "startup_time": 1760000000.0,
18
18
  "sync_direction": "bidirectional"
@@ -18,7 +18,7 @@
18
18
  "capacity": 20,
19
19
  "reachable": true,
20
20
  "server_ready": true,
21
- "force_master": false,
21
+ "prefer_master": false,
22
22
  "never_master": false,
23
23
  "startup_time": 1760000000.0,
24
24
  "sync_direction": "bidirectional"
@@ -4,60 +4,60 @@
4
4
  "candidates": [
5
5
  {
6
6
  "cid": "local",
7
- "force_master": true,
8
7
  "never_master": false,
8
+ "prefer_master": true,
9
9
  "server_ready": false,
10
10
  "startup_time": 10.0,
11
11
  "sync_direction": "bidirectional"
12
12
  },
13
13
  {
14
14
  "cid": "incumbent",
15
- "force_master": false,
16
15
  "never_master": false,
16
+ "prefer_master": false,
17
17
  "server_ready": true,
18
18
  "startup_time": 200.0,
19
19
  "sync_direction": "bidirectional"
20
20
  }
21
21
  ],
22
22
  "expected_master": "incumbent",
23
- "name": "incumbent-server-ready-wins-over-force-master"
23
+ "name": "incumbent-server-ready-wins-over-prefer-master"
24
24
  },
25
25
  {
26
26
  "candidates": [
27
27
  {
28
28
  "cid": "plain",
29
- "force_master": false,
30
29
  "never_master": false,
30
+ "prefer_master": false,
31
31
  "server_ready": false,
32
32
  "startup_time": 50.0,
33
33
  "sync_direction": "bidirectional"
34
34
  },
35
35
  {
36
36
  "cid": "forced",
37
- "force_master": true,
38
37
  "never_master": false,
38
+ "prefer_master": true,
39
39
  "server_ready": false,
40
40
  "startup_time": 300.0,
41
41
  "sync_direction": "bidirectional"
42
42
  }
43
43
  ],
44
44
  "expected_master": "forced",
45
- "name": "force-master-wins-over-plain-peer"
45
+ "name": "prefer-master-wins-over-plain-peer"
46
46
  },
47
47
  {
48
48
  "candidates": [
49
49
  {
50
50
  "cid": "aaa",
51
- "force_master": false,
52
51
  "never_master": false,
52
+ "prefer_master": false,
53
53
  "server_ready": false,
54
54
  "startup_time": 100.0,
55
55
  "sync_direction": "upload-only"
56
56
  },
57
57
  {
58
58
  "cid": "bbb",
59
- "force_master": false,
60
59
  "never_master": false,
60
+ "prefer_master": false,
61
61
  "server_ready": false,
62
62
  "startup_time": 100.0,
63
63
  "sync_direction": "bidirectional"
@@ -70,16 +70,16 @@
70
70
  "candidates": [
71
71
  {
72
72
  "cid": "late",
73
- "force_master": false,
74
73
  "never_master": false,
74
+ "prefer_master": false,
75
75
  "server_ready": false,
76
76
  "startup_time": 200.0,
77
77
  "sync_direction": "bidirectional"
78
78
  },
79
79
  {
80
80
  "cid": "early",
81
- "force_master": false,
82
81
  "never_master": false,
82
+ "prefer_master": false,
83
83
  "server_ready": false,
84
84
  "startup_time": 100.0,
85
85
  "sync_direction": "bidirectional"
@@ -92,16 +92,16 @@
92
92
  "candidates": [
93
93
  {
94
94
  "cid": "zzz",
95
- "force_master": false,
96
95
  "never_master": false,
96
+ "prefer_master": false,
97
97
  "server_ready": false,
98
98
  "startup_time": 100.0,
99
99
  "sync_direction": "bidirectional"
100
100
  },
101
101
  {
102
102
  "cid": "aaa",
103
- "force_master": false,
104
103
  "never_master": false,
104
+ "prefer_master": false,
105
105
  "server_ready": false,
106
106
  "startup_time": 100.0,
107
107
  "sync_direction": "bidirectional"
@@ -114,16 +114,16 @@
114
114
  "candidates": [
115
115
  {
116
116
  "cid": "early",
117
- "force_master": false,
118
117
  "never_master": false,
118
+ "prefer_master": false,
119
119
  "server_ready": false,
120
120
  "startup_time": 100.0,
121
121
  "sync_direction": "bidirectional"
122
122
  },
123
123
  {
124
124
  "cid": "later",
125
- "force_master": false,
126
125
  "never_master": false,
126
+ "prefer_master": false,
127
127
  "server_ready": false,
128
128
  "startup_time": 200.0,
129
129
  "sync_direction": "bidirectional"
@@ -136,16 +136,16 @@
136
136
  "candidates": [
137
137
  {
138
138
  "cid": "never",
139
- "force_master": false,
140
139
  "never_master": true,
140
+ "prefer_master": false,
141
141
  "server_ready": false,
142
142
  "startup_time": 100.0,
143
143
  "sync_direction": "bidirectional"
144
144
  },
145
145
  {
146
146
  "cid": "eligible",
147
- "force_master": false,
148
147
  "never_master": false,
148
+ "prefer_master": false,
149
149
  "server_ready": false,
150
150
  "startup_time": 200.0,
151
151
  "sync_direction": "bidirectional"
@@ -158,16 +158,16 @@
158
158
  "candidates": [
159
159
  {
160
160
  "cid": "a",
161
- "force_master": false,
162
161
  "never_master": true,
162
+ "prefer_master": false,
163
163
  "server_ready": false,
164
164
  "startup_time": 100.0,
165
165
  "sync_direction": "bidirectional"
166
166
  },
167
167
  {
168
168
  "cid": "b",
169
- "force_master": false,
170
169
  "never_master": true,
170
+ "prefer_master": false,
171
171
  "server_ready": false,
172
172
  "startup_time": 200.0,
173
173
  "sync_direction": "bidirectional"
@@ -206,17 +206,17 @@ def _p2p_inventory_delta_delete() -> dict[str, Any]:
206
206
  # Android parity test replay these exact inputs and must reach the same outcome.
207
207
  _ELECTION_SCENARIOS: tuple[tuple[str, tuple[ElectionCandidate, ...]], ...] = (
208
208
  (
209
- "incumbent-server-ready-wins-over-force-master",
209
+ "incumbent-server-ready-wins-over-prefer-master",
210
210
  (
211
- ElectionCandidate(cid="local", force_master=True, startup_time=10.0),
211
+ ElectionCandidate(cid="local", prefer_master=True, startup_time=10.0),
212
212
  ElectionCandidate(cid="incumbent", startup_time=200.0, server_ready=True),
213
213
  ),
214
214
  ),
215
215
  (
216
- "force-master-wins-over-plain-peer",
216
+ "prefer-master-wins-over-plain-peer",
217
217
  (
218
218
  ElectionCandidate(cid="plain", startup_time=50.0),
219
- ElectionCandidate(cid="forced", force_master=True, startup_time=300.0),
219
+ ElectionCandidate(cid="forced", prefer_master=True, startup_time=300.0),
220
220
  ),
221
221
  ),
222
222
  (
@@ -31,12 +31,6 @@
31
31
  ],
32
32
  "type": "string"
33
33
  },
34
- "force_master": {
35
- "enum": [
36
- "true"
37
- ],
38
- "type": "string"
39
- },
40
34
  "group": {
41
35
  "type": "string"
42
36
  },
@@ -64,6 +58,12 @@
64
58
  ],
65
59
  "type": "string"
66
60
  },
61
+ "prefer_master": {
62
+ "enum": [
63
+ "true"
64
+ ],
65
+ "type": "string"
66
+ },
67
67
  "protocol": {
68
68
  "const": "p2p/1"
69
69
  },
@@ -14,7 +14,7 @@ Ordering (highest priority first):
14
14
 
15
15
  1. ``server_ready`` — an already-serving incumbent wins, so a newcomer never
16
16
  triggers a takeover/split-brain for the same bucket.
17
- 2. ``force_master`` — an operator-pinned master wins over ordinary peers.
17
+ 2. ``prefer_master`` — an operator-preferred master wins over ordinary peers.
18
18
  3. bidirectional ``sync_direction`` — a fully bidirectional peer is preferred
19
19
  over an upload-only/download-only one (it can serve every other peer).
20
20
  4. earliest ``startup_time`` — the node that started first wins.
@@ -79,7 +79,7 @@ class ElectionCandidate:
79
79
  """
80
80
 
81
81
  cid: str
82
- force_master: bool = False
82
+ prefer_master: bool = False
83
83
  startup_time: float = 0.0
84
84
  sync_direction: str = SYNC_DIRECTION_BIDIRECTIONAL
85
85
  server_ready: bool = False
@@ -94,7 +94,7 @@ def election_sort_key(candidate: ElectionCandidate) -> tuple[bool, bool, bool, f
94
94
  """
95
95
  return (
96
96
  not candidate.server_ready,
97
- not candidate.force_master,
97
+ not candidate.prefer_master,
98
98
  candidate.sync_direction != SYNC_DIRECTION_BIDIRECTIONAL,
99
99
  candidate.startup_time,
100
100
  candidate.cid,
@@ -108,7 +108,7 @@ def rank_election_candidates(
108
108
 
109
109
  ``never_master`` nodes are filtered out first. Callers that need more than
110
110
  the winner (e.g. the client's pre-computed successor, or the ranked
111
- ``force_master`` subset for conflict reporting) must use this function so
111
+ ``prefer_master`` subset for conflict reporting) must use this function so
112
112
  the ranking itself lives only here; :func:`elect_master` is its
113
113
  winner-only projection.
114
114
  """
@@ -386,7 +386,7 @@
386
386
  },
387
387
  "info": {
388
388
  "title": "HSYNC - HTTP Sync file server",
389
- "version": "1.0.2"
389
+ "version": "1.0.4"
390
390
  },
391
391
  "openapi": "3.1.0",
392
392
  "paths": {
@@ -74,7 +74,7 @@ P2P_TXT_OPTIONAL_KEYS: tuple[str, ...] = (
74
74
  "compression",
75
75
  "delta",
76
76
  "server_ready",
77
- "force_master",
77
+ "prefer_master",
78
78
  "never_master",
79
79
  "connected",
80
80
  "heartbeat",
@@ -770,7 +770,7 @@ def build_p2p_txt_schema() -> dict[str, Any]:
770
770
  "compression": _TXT_BOOL_FLAG,
771
771
  "delta": _TXT_BOOL_FLAG,
772
772
  "server_ready": _TXT_BOOL_FLAG,
773
- "force_master": _TXT_BOOL_FLAG,
773
+ "prefer_master": _TXT_BOOL_FLAG,
774
774
  "never_master": _TXT_BOOL_FLAG,
775
775
  "peer_download": {
776
776
  **_TXT_BOOL_FLAG,
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hsync-common"
3
- version = "1.0.2"
3
+ version = "1.0.4"
4
4
  description = "HSYNC Common - shared models, constants, and compression utilities"
5
5
  authors = [{name = "Alberto Basso", email = "17047798+albertsdk@users.noreply.github.com"}]
6
6
  license = "BSD-3-Clause"
@@ -43,7 +43,7 @@ packages = [{include = "hsync_common"}]
43
43
 
44
44
  [tool.poetry.group.dev.dependencies]
45
45
  pytest = "^9.1.1"
46
- ruff = "0.16.10"
46
+ ruff = "0.17.0"
47
47
  pre-commit = "^4.6.2"
48
48
  pytest-cov = "^7.1.0"
49
49
 
File without changes
File without changes