semiont 0.6.12.dev2__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.
- semiont/__init__.py +20 -0
- semiont/bus.py +236 -0
- semiont/cache.py +345 -0
- semiont/cached.py +152 -0
- semiont/channel.py +81 -0
- semiont/channels.py +1306 -0
- semiont/client.py +161 -0
- semiont/error_codes.py +232 -0
- semiont/errors.py +147 -0
- semiont/event_bus.py +108 -0
- semiont/events.py +101 -0
- semiont/http/__init__.py +24 -0
- semiont/http/agent.py +232 -0
- semiont/http/content.py +234 -0
- semiont/http/exchange.py +200 -0
- semiont/http/oauth.py +346 -0
- semiont/http/session.py +191 -0
- semiont/http/sse.py +71 -0
- semiont/http/stream.py +683 -0
- semiont/http/transport.py +326 -0
- semiont/identifiers.py +114 -0
- semiont/identity.py +59 -0
- semiont/media_types.py +69 -0
- semiont/media_types_table.py +89 -0
- semiont/model.py +33 -0
- semiont/namespaces/__init__.py +19 -0
- semiont/namespaces/auth.py +32 -0
- semiont/namespaces/beckon.py +47 -0
- semiont/namespaces/bind.py +38 -0
- semiont/namespaces/browse.py +338 -0
- semiont/namespaces/follow.py +238 -0
- semiont/namespaces/frame.py +35 -0
- semiont/namespaces/gather.py +82 -0
- semiont/namespaces/job.py +94 -0
- semiont/namespaces/links.py +66 -0
- semiont/namespaces/live.py +301 -0
- semiont/namespaces/mark.py +174 -0
- semiont/namespaces/match.py +67 -0
- semiont/namespaces/refresher.py +283 -0
- semiont/namespaces/system.py +24 -0
- semiont/namespaces/yield_.py +101 -0
- semiont/oauth_clients.py +27 -0
- semiont/operations.py +337 -0
- semiont/py.typed +0 -0
- semiont/refresh.py +188 -0
- semiont/resume.py +95 -0
- semiont/retry.py +164 -0
- semiont/running.py +110 -0
- semiont/session.py +493 -0
- semiont/sign_in.py +54 -0
- semiont/sign_in_store.py +283 -0
- semiont/storage.py +139 -0
- semiont/telemetry.py +116 -0
- semiont/telemetry_table.py +121 -0
- semiont/testing/__init__.py +62 -0
- semiont/testing/client.py +53 -0
- semiont/testing/content.py +124 -0
- semiont/testing/gateway.py +85 -0
- semiont/testing/transport.py +341 -0
- semiont/timing.py +187 -0
- semiont/transport.py +531 -0
- semiont/types.py +5902 -0
- semiont/watched.py +111 -0
- semiont-0.6.12.dev2.dist-info/METADATA +533 -0
- semiont-0.6.12.dev2.dist-info/RECORD +66 -0
- semiont-0.6.12.dev2.dist-info/WHEEL +4 -0
semiont/timing.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Generated from specs/src/client/timing.json; do not edit.
|
|
2
|
+
# Regenerate: node scripts/spec/generate-client-timing-python.mjs
|
|
3
|
+
|
|
4
|
+
"""The timing a Semiont client keeps: its deadlines, its retry budgets, the
|
|
5
|
+
cadence of its stream, and what it keeps count of.
|
|
6
|
+
|
|
7
|
+
Each constant is an entry of the table every SDK generates from, under the
|
|
8
|
+
entry's own name: `emitRetry` is `EMIT_RETRY`. `TIMING_NAMES` lists the names
|
|
9
|
+
as the table states them, which is how a caller overrides one.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from typing import Final
|
|
13
|
+
|
|
14
|
+
from semiont.retry import RetryPolicy
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ASSIST_SILENCE_MS",
|
|
18
|
+
"BUS_REQUEST_TIMEOUT_MS",
|
|
19
|
+
"DEGRADED_THRESHOLD_MS",
|
|
20
|
+
"EMIT_RETRY",
|
|
21
|
+
"EMIT_TIMEOUT_MS",
|
|
22
|
+
"GENERATION_STALL_ASSUMED_TOKENS_COUNT",
|
|
23
|
+
"GENERATION_STALL_FLOOR_MS",
|
|
24
|
+
"GENERATION_STALL_PER_TOKEN_MS",
|
|
25
|
+
"HOVER_DELAY_MS",
|
|
26
|
+
"HTTP_REQUEST_TIMEOUT_MS",
|
|
27
|
+
"INVALIDATION_WINDOW_MS",
|
|
28
|
+
"JOB_SILENCE_MS",
|
|
29
|
+
"JOB_STATUS_POLL_MS",
|
|
30
|
+
"LAZY_REMOVE_MS",
|
|
31
|
+
"LINGER_MS",
|
|
32
|
+
"MAX_RECONNECT_MS",
|
|
33
|
+
"MIN_REFRESH_DELAY_MS",
|
|
34
|
+
"RECONNECT_DEBOUNCE_MS",
|
|
35
|
+
"RECONNECT_MS",
|
|
36
|
+
"REFRESH_BEFORE_EXP_MS",
|
|
37
|
+
"REFRESH_RETRY",
|
|
38
|
+
"SEARCH_DEBOUNCE_MS",
|
|
39
|
+
"SEEN_EVENT_IDS_COUNT",
|
|
40
|
+
"TIMING_NAMES",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
# How long a bus request waits for its reply. The gateway keeps a reply for redelivery at least
|
|
44
|
+
# twice this long (`replyRetentionSeconds` on POST /bus/subscribe), so a reply published during
|
|
45
|
+
# an outage is still there when the requester reconnects inside its own deadline.
|
|
46
|
+
BUS_REQUEST_TIMEOUT_MS: Final = 30000
|
|
47
|
+
|
|
48
|
+
# The deadline on one POST /bus/emit. The gateway accepts an emit promptly; one still unanswered
|
|
49
|
+
# here means the gateway is unresponsive, and the emit is rejected rather than awaited forever.
|
|
50
|
+
# Without it a worker's emit to a wedged gateway hangs its loop.
|
|
51
|
+
EMIT_TIMEOUT_MS: Final = 30000
|
|
52
|
+
|
|
53
|
+
# The retry budget of ONE emit. Per request, never per boot pass: re-running a whole catch-up
|
|
54
|
+
# pass to recover from one refusal re-sends hundreds of emits that already succeeded. Small on
|
|
55
|
+
# purpose: an emit a caller awaits must fail while the caller still cares, and the patience for
|
|
56
|
+
# a gateway that is down belongs to the pass above it.
|
|
57
|
+
EMIT_RETRY: Final = RetryPolicy(attempts=4, initial_delay_ms=1000, max_delay_ms=4000)
|
|
58
|
+
|
|
59
|
+
# The deadline on one HTTP request that is neither the stream nor an emit: one of the gateway's
|
|
60
|
+
# own operations (who a token is, a media token, an agent's token, the resource metadata,
|
|
61
|
+
# health, status), the wait for a resource's bytes to begin arriving, a request to the issuer
|
|
62
|
+
# (its discovery, a grant, a revocation), and a read of a launcher's discovery document.
|
|
63
|
+
# Unanswered here, the request fails as one that got no answer. Without it, a gateway or an
|
|
64
|
+
# issuer that accepts a connection and never answers holds a session's start, and every renewal
|
|
65
|
+
# after it, for as long as the process lives. An upload has no deadline: how long it takes is
|
|
66
|
+
# how large the resource is.
|
|
67
|
+
HTTP_REQUEST_TIMEOUT_MS: Final = 30000
|
|
68
|
+
|
|
69
|
+
# The first wait before a failed stream is opened again. Each further failure doubles it, up to
|
|
70
|
+
# `maxReconnectMs`, and a successful open resets it. Also the cadence at which a transport with
|
|
71
|
+
# no usable credential checks for one, which costs no request.
|
|
72
|
+
RECONNECT_MS: Final = 5000
|
|
73
|
+
|
|
74
|
+
# The ceiling of the reconnect backoff: a long outage settles at about one attempt a minute
|
|
75
|
+
# instead of growing without bound.
|
|
76
|
+
MAX_RECONNECT_MS: Final = 60000
|
|
77
|
+
|
|
78
|
+
# How long a stream may be reconnecting before its state becomes degraded.
|
|
79
|
+
DEGRADED_THRESHOLD_MS: Final = 3000
|
|
80
|
+
|
|
81
|
+
# How long a superseded connection keeps draining after a make-before-break handoff. Closing it
|
|
82
|
+
# the instant its replacement opens discards replies already written to the old socket and not
|
|
83
|
+
# yet read. The overlap doubles nothing: a frame both connections carry has one id, and is
|
|
84
|
+
# delivered once (`seenEventIdsCount`).
|
|
85
|
+
LINGER_MS: Final = 1000
|
|
86
|
+
|
|
87
|
+
# How many of the event ids it delivered last a client remembers. A frame whose id is among them
|
|
88
|
+
# is one it has delivered already, and is dropped: that is what makes a frame carried by both
|
|
89
|
+
# streams of a handoff, or replayed to the new one, arrive once. A client that remembers fewer
|
|
90
|
+
# delivers twice whenever more than that many events pass between the two copies.
|
|
91
|
+
SEEN_EVENT_IDS_COUNT: Final = 512
|
|
92
|
+
|
|
93
|
+
# How long additions to the subscription are gathered before the stream is reopened with them.
|
|
94
|
+
# Short, because a new scope needs to be live now.
|
|
95
|
+
RECONNECT_DEBOUNCE_MS: Final = 100
|
|
96
|
+
|
|
97
|
+
# How long a removal from the subscription waits before the stream is reopened without it.
|
|
98
|
+
# Removal only narrows delivery, and reopening on every scope a viewer brushes past would churn
|
|
99
|
+
# the connection.
|
|
100
|
+
LAZY_REMOVE_MS: Final = 5000
|
|
101
|
+
|
|
102
|
+
# The retry budget of one token renewal: long enough to ride out a gateway restart or a rolling
|
|
103
|
+
# deploy, short enough that a user with no connectivity is told within seconds rather than a
|
|
104
|
+
# minute.
|
|
105
|
+
REFRESH_RETRY: Final = RetryPolicy(attempts=4, initial_delay_ms=500, max_delay_ms=4000)
|
|
106
|
+
|
|
107
|
+
# The LARGEST margin before expiry at which a token is proactively renewed. A ceiling, not the
|
|
108
|
+
# margin: the margin is half the token's own lifetime, capped here. A fixed margin can equal the
|
|
109
|
+
# lifetime an issuer mints (Keycloak's default is five minutes), which makes every renewal
|
|
110
|
+
# already due: an idle signed-in page then sends over a hundred token requests a second.
|
|
111
|
+
REFRESH_BEFORE_EXP_MS: Final = 300000
|
|
112
|
+
|
|
113
|
+
# The shortest the proactive renewal ever waits. A timer due now that reschedules itself on
|
|
114
|
+
# arrival is a closed loop; a floor makes that impossible, so even an issuer minting expired
|
|
115
|
+
# tokens gets one attempt per interval. Waiting is cheap here: a 401 still drives a renewal.
|
|
116
|
+
MIN_REFRESH_DELAY_MS: Final = 10000
|
|
117
|
+
|
|
118
|
+
# How long bus-driven invalidations of one cache key fold together (CACHE-SEMANTICS B19). The
|
|
119
|
+
# first runs at once; any more inside the window become one refetch at its end. Each refetch is
|
|
120
|
+
# a request the session's principal pays for, and another principal's bulk write invalidates an
|
|
121
|
+
# observed key once per event.
|
|
122
|
+
INVALIDATION_WINDOW_MS: Final = 1000
|
|
123
|
+
|
|
124
|
+
# How long a job a client is following may say nothing before the client asks for its status. A
|
|
125
|
+
# job's progress and its end reach the client as passing frames, which a dropped stream loses
|
|
126
|
+
# and nothing redelivers; `job:status-requested` is how a follower learns what it missed. Every
|
|
127
|
+
# frame of the job starts the wait again.
|
|
128
|
+
JOB_SILENCE_MS: Final = 10000
|
|
129
|
+
|
|
130
|
+
# How often a client asks for the status of a job that has been silent for `jobSilenceMs`, until
|
|
131
|
+
# the job says something or its status is an end.
|
|
132
|
+
JOB_STATUS_POLL_MS: Final = 5000
|
|
133
|
+
|
|
134
|
+
# The shortest a client waits, with a generation it follows saying nothing, before it asks for
|
|
135
|
+
# the job to be cancelled and gives up on it. A floor, so a job that never says anything at all
|
|
136
|
+
# is caught whatever its size.
|
|
137
|
+
GENERATION_STALL_FLOOR_MS: Final = 120000
|
|
138
|
+
|
|
139
|
+
# How long a followed generation may be silent for each token it was asked for. A generation
|
|
140
|
+
# says nothing while its model writes, so the wait grows with the length of what was asked: four
|
|
141
|
+
# thousand tokens allow five minutes. The floor applies below it.
|
|
142
|
+
GENERATION_STALL_PER_TOKEN_MS: Final = 75
|
|
143
|
+
|
|
144
|
+
# The length assumed of a generation whose request states no `maxTokens`: the worker's own
|
|
145
|
+
# ceiling for one. At this length the floor decides the wait.
|
|
146
|
+
GENERATION_STALL_ASSUMED_TOKENS_COUNT: Final = 500
|
|
147
|
+
|
|
148
|
+
# How long an assist a client's state is following may say nothing before that state says the
|
|
149
|
+
# assist has gone quiet (`mark:assist-timeout`). Not a deadline on the job: the job goes on, the
|
|
150
|
+
# state keeps following it, and a completion that arrives later still ends it. Above the
|
|
151
|
+
# worker's heartbeat, so reaching it means silence and not a long call.
|
|
152
|
+
ASSIST_SILENCE_MS: Final = 180000
|
|
153
|
+
|
|
154
|
+
# How long a pointer rests on an annotation before the viewer says it is hovered. Shorter, and a
|
|
155
|
+
# pointer crossing the page hovers everything on its way.
|
|
156
|
+
HOVER_DELAY_MS: Final = 150
|
|
157
|
+
|
|
158
|
+
# How long a search waits after its query last changed before it asks. A query still being typed
|
|
159
|
+
# is not asked for letter by letter.
|
|
160
|
+
SEARCH_DEBOUNCE_MS: Final = 250
|
|
161
|
+
|
|
162
|
+
# Every entry's name, as the table states it.
|
|
163
|
+
TIMING_NAMES: Final[tuple[str, ...]] = (
|
|
164
|
+
"busRequestTimeoutMs",
|
|
165
|
+
"emitTimeoutMs",
|
|
166
|
+
"emitRetry",
|
|
167
|
+
"httpRequestTimeoutMs",
|
|
168
|
+
"reconnectMs",
|
|
169
|
+
"maxReconnectMs",
|
|
170
|
+
"degradedThresholdMs",
|
|
171
|
+
"lingerMs",
|
|
172
|
+
"seenEventIdsCount",
|
|
173
|
+
"reconnectDebounceMs",
|
|
174
|
+
"lazyRemoveMs",
|
|
175
|
+
"refreshRetry",
|
|
176
|
+
"refreshBeforeExpMs",
|
|
177
|
+
"minRefreshDelayMs",
|
|
178
|
+
"invalidationWindowMs",
|
|
179
|
+
"jobSilenceMs",
|
|
180
|
+
"jobStatusPollMs",
|
|
181
|
+
"generationStallFloorMs",
|
|
182
|
+
"generationStallPerTokenMs",
|
|
183
|
+
"generationStallAssumedTokensCount",
|
|
184
|
+
"assistSilenceMs",
|
|
185
|
+
"hoverDelayMs",
|
|
186
|
+
"searchDebounceMs",
|
|
187
|
+
)
|