encore-dev 2.0.0a7__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.
Files changed (44) hide show
  1. encore/__init__.py +43 -0
  2. encore/cron/__init__.py +50 -0
  3. encore/internal/__init__.py +1 -0
  4. encore/internal/_loader.py +79 -0
  5. encore/internal/_native.pyi +734 -0
  6. encore/internal/lazy.py +35 -0
  7. encore/internal/runtime.py +133 -0
  8. encore/internal/startup.py +24 -0
  9. encore/logs/__init__.py +19 -0
  10. encore/logs/_console.py +155 -0
  11. encore/logs/_runtime.py +56 -0
  12. encore/meta/__init__.py +228 -0
  13. encore/metrics/__init__.py +390 -0
  14. encore/pubsub/__init__.py +425 -0
  15. encore/py.typed +0 -0
  16. encore/secrets/__init__.py +139 -0
  17. encore/shutdown/__init__.py +164 -0
  18. encore/storage/__init__.py +5 -0
  19. encore/storage/objects/__init__.py +396 -0
  20. encore/storage/postgres/__init__.py +737 -0
  21. encore/storage/redis/__init__.py +200 -0
  22. encore/storage/redis/_base.py +42 -0
  23. encore/storage/redis/_responses.py +150 -0
  24. encore/storage/redis/_values.py +189 -0
  25. encore/storage/redis/bitmap.py +142 -0
  26. encore/storage/redis/generic.py +367 -0
  27. encore/storage/redis/geo.py +508 -0
  28. encore/storage/redis/hash.py +504 -0
  29. encore/storage/redis/json.py +614 -0
  30. encore/storage/redis/list.py +511 -0
  31. encore/storage/redis/pubsub.py +276 -0
  32. encore/storage/redis/set.py +570 -0
  33. encore/storage/redis/sorted_set.py +753 -0
  34. encore/storage/redis/stream.py +773 -0
  35. encore/storage/redis/string.py +654 -0
  36. encore/tracing/__init__.py +19 -0
  37. encore/tracing/_context.py +27 -0
  38. encore/tracing/_encode.py +351 -0
  39. encore/tracing/_provider.py +62 -0
  40. encore/tracing/_span.py +226 -0
  41. encore/tracing/_tracer.py +93 -0
  42. encore_dev-2.0.0a7.dist-info/METADATA +791 -0
  43. encore_dev-2.0.0a7.dist-info/RECORD +44 -0
  44. encore_dev-2.0.0a7.dist-info/WHEEL +4 -0
@@ -0,0 +1,734 @@
1
+ # Generated by cargo xtask build-py-runtime. Do not edit manually.
2
+ import typing
3
+
4
+ from collections.abc import Sequence
5
+ from datetime import datetime
6
+ from typing import Any, Final, final
7
+
8
+ RUNTIME_LOGGER: Final[str]
9
+ """
10
+ The logger of the runtime's own lines.
11
+ """
12
+
13
+ @final
14
+ class AttrsOptions:
15
+ def __new__(cls, /, *, version: str |None = None) -> "AttrsOptions": ...
16
+
17
+ @final
18
+ class Bucket:
19
+ def list(self, /, options: ListOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[ListIterator]": ...
20
+ def object(self, /, name: str) -> "BucketObject": ...
21
+
22
+ @final
23
+ class BucketObject:
24
+ def attrs(self, /, options: AttrsOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[ObjectAttrs]": ...
25
+ def delete(self, /, options: DeleteOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[None]": ...
26
+ def download_all(self, /, options: DownloadOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[bytes]": ...
27
+ def download_stream(self, /, options: DownloadOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[DownloadStream]": ...
28
+ def exists(self, /, options: ExistsOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
29
+ def public_url(self, /) -> "str": ...
30
+ def signed_download_url(self, /, options: DownloadUrlOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[str]": ...
31
+ def signed_upload_url(self, /, options: UploadUrlOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[str]": ...
32
+ def upload(self, /, data: bytes, options: UploadOptions |None = None, source: bytes |None = None) -> "typing.Awaitable[ObjectAttrs]": ...
33
+ def upload_stream(self, /, options: UploadOptions |None = None, source: bytes |None = None) -> "UploadStream": ...
34
+
35
+ @final
36
+ class ByteRange:
37
+ def __new__(cls, /, *, offset: int, length: int |None = None) -> "ByteRange": ...
38
+
39
+ @final
40
+ class DeleteOptions:
41
+ def __new__(cls, /, *, version: str |None = None) -> "DeleteOptions": ...
42
+
43
+ @final
44
+ class DownloadOptions:
45
+ def __new__(cls, /, *, version: str |None = None, range: ByteRange |None = None) -> "DownloadOptions": ...
46
+
47
+ @final
48
+ class DownloadStream:
49
+ def close(self, /) -> "typing.Awaitable[None]": ...
50
+ def next(self, /) -> "typing.Awaitable[typing.Optional[bytes]]": ...
51
+
52
+ @final
53
+ class DownloadUrlOptions:
54
+ def __new__(cls, /, *, ttl: int |None = None) -> "DownloadUrlOptions": ...
55
+
56
+ @final
57
+ class ExistsOptions:
58
+ def __new__(cls, /, *, version: str |None = None) -> "ExistsOptions": ...
59
+
60
+ @final
61
+ class ListEntry:
62
+ @property
63
+ def etag(self, /) -> str: ...
64
+ @property
65
+ def name(self, /) -> str: ...
66
+ @property
67
+ def size(self, /) -> int: ...
68
+
69
+ @final
70
+ class ListIterator:
71
+ def mark_done(self, /) -> "typing.Awaitable[None]": ...
72
+ def next(self, /) -> "typing.Awaitable[typing.Optional[ListEntry]]": ...
73
+
74
+ @final
75
+ class ListOptions:
76
+ def __new__(cls, /, *, prefix: str |None = None, limit: int |None = None) -> "ListOptions": ...
77
+
78
+ @final
79
+ class MetricType:
80
+ Counter: Final[MetricType]
81
+ FloatCounter: Final[MetricType]
82
+ Gauge: Final[MetricType]
83
+ Histogram: Final[MetricType]
84
+ def __eq__(self, value: object, /) -> bool: ...
85
+ def __int__(self, /) -> int: ...
86
+ def __ne__(self, value: object, /) -> bool: ...
87
+ def __repr__(self, /) -> str: ...
88
+
89
+ @final
90
+ class MetricsRegistry:
91
+ def allocate_slot(self, /, name: str, labels: Sequence[tuple[str, str]], metric_type: MetricType) -> "int":
92
+ """
93
+ Allocate or reuse a metric slot. Label names are normalized to snake_case;
94
+ the runtime adds the reserved service label automatically.
95
+ """
96
+ def increment(self, /, slot: int, value: int = 1) -> "None":
97
+ """
98
+ Increment a counter by an unsigned integer. The total wraps on 64-bit overflow.
99
+ """
100
+ def increment_float(self, /, slot: int, value: float = 1.0) -> "None":
101
+ """
102
+ Add a finite, nonnegative value to a floating-point counter.
103
+ Reject an update that would overflow the total without changing it.
104
+ """
105
+ def observe(self, /, slot: int, value: float) -> "None":
106
+ """
107
+ Record an observation using the core's automatic exponential buckets.
108
+ NaN counts without a bucket and makes the sum NaN; infinities are bucketed.
109
+ """
110
+ def set(self, /, slot: int, value: float) -> "None":
111
+ """
112
+ Set a gauge to a finite floating-point value.
113
+ """
114
+ def slot_count(self, /) -> "int":
115
+ """
116
+ The number of registered metric and label combinations.
117
+ """
118
+
119
+ @final
120
+ class ObjectAttrs:
121
+ @property
122
+ def content_type(self, /) -> str |None: ...
123
+ @property
124
+ def etag(self, /) -> str: ...
125
+ @property
126
+ def name(self, /) -> str: ...
127
+ @property
128
+ def size(self, /) -> int: ...
129
+ @property
130
+ def version(self, /) -> str |None: ...
131
+
132
+ @final
133
+ class Pipeline:
134
+ """
135
+ Span lifecycle calls into the telemetry pipeline. Synchronous: no call
136
+ waits on I/O.
137
+ """
138
+ def dropped(self, /) -> "int":
139
+ """
140
+ The number of telemetry items dropped because the queue was full.
141
+ """
142
+ def end_span(self, /, packed: bytes) -> "None":
143
+ """
144
+ Ends a span. `packed`: the finished span in the packed layout.
145
+ """
146
+ def start_span(self, /, name: str, kind: int, parent: bytes |None, tracestate: str |None, start_unix_nanos: int |None, packed: bytes) -> "tuple[bytes, str, int, int]":
147
+ """
148
+ Starts a span. `parent`: 25-byte context, with `tracestate`.
149
+ `packed`: start scope, attributes, and links in the packed layout.
150
+ Returns the span's 25-byte context, tracestate, and start clocks
151
+ (unix, monotonic nanoseconds).
152
+ """
153
+
154
+ @final
155
+ class PostgresCursor:
156
+ """
157
+ A streaming query result that retains its connection or transaction.
158
+
159
+ Exhaust or close the cursor to release the borrowed handle. Destroying the
160
+ cursor also releases the handle once any in-flight operation finishes.
161
+ """
162
+ def close(self, /) -> "typing.Awaitable[None]":
163
+ """
164
+ Release the cursor's connection or transaction borrow.
165
+
166
+ Returns:
167
+ An awaitable that completes after any active read finishes and the cursor
168
+ closes. Repeated closes have no effect.
169
+ """
170
+ def next(self, /) -> "typing.Awaitable[typing.Optional[dict[str, typing.Any]]]":
171
+ """
172
+ Fetch the next row asynchronously.
173
+
174
+ Requires that no other read is active.
175
+
176
+ Returns:
177
+ An awaitable that produces a dictionary of column names to decoded Python
178
+ values, or None when the cursor is exhausted or closed. Exhaustion releases
179
+ the borrowed connection or transaction.
180
+
181
+ Raises:
182
+ EncoreError: Reading or decoding a row fails.
183
+ """
184
+
185
+ @final
186
+ class PostgresHandle:
187
+ """
188
+ A native database, connection, or transaction handle.
189
+
190
+ Python's public wrappers expose the operations appropriate to each handle.
191
+ Query cursors retain exclusive use of a connection or transaction until they
192
+ are exhausted or closed.
193
+ """
194
+ def acquire(self, /, source: bytes |None = None) -> "typing.Awaitable[PostgresHandle]":
195
+ """
196
+ Acquire a connection from a database's pool.
197
+
198
+ Requires a database handle.
199
+
200
+ Args:
201
+ source: Encoded parent tracing context, or None when no context is active.
202
+
203
+ Returns:
204
+ An awaitable that produces a connection handle. Close the handle to return
205
+ the connection to its pool.
206
+
207
+ Raises:
208
+ EncoreError: Acquiring a connection fails.
209
+ """
210
+ def begin(self, /, source: bytes |None = None) -> "typing.Awaitable[PostgresHandle]":
211
+ """
212
+ Begin a transaction on a database or acquired connection.
213
+
214
+ Requires a database handle or an open connection with no active operation,
215
+ transaction, or cursor.
216
+
217
+ Args:
218
+ source: Encoded parent tracing context, or None when no context is active.
219
+
220
+ Returns:
221
+ An awaitable that produces a transaction handle. A transaction on an
222
+ acquired connection retains exclusive use of it until completion.
223
+
224
+ Raises:
225
+ EncoreError: Acquiring a connection or beginning the transaction fails.
226
+ """
227
+ def close(self, /) -> "typing.Awaitable[None]":
228
+ """
229
+ Close an acquired connection and return it to the pool.
230
+
231
+ Requires a connection handle with no active operation, transaction, or cursor.
232
+
233
+ Returns:
234
+ An awaitable that completes when the connection is returned. Repeated
235
+ closes on a connection handle have no effect.
236
+ """
237
+ def commit(self, /) -> "typing.Awaitable[None]":
238
+ """
239
+ Commit a transaction and consume its handle.
240
+
241
+ Requires an open transaction with no active operation or cursor.
242
+ Once completion starts, cancelling the await does not interrupt completion.
243
+ Any borrowed connection stays unavailable until completion finishes.
244
+
245
+ Returns:
246
+ An awaitable that completes when Postgres finishes committing.
247
+
248
+ Raises:
249
+ EncoreError: Committing fails.
250
+ """
251
+ def conn_string(self, /) -> "str":
252
+ """
253
+ Return the database's proxy connection string.
254
+
255
+ Requires a database handle.
256
+
257
+ Returns:
258
+ The URL for connecting to the database through the local proxy.
259
+ """
260
+ def exec(self, /, sql: str, params: Sequence[Any], source: bytes |None = None) -> "typing.Awaitable[int]":
261
+ """
262
+ Execute a statement and return an awaitable affected-row count.
263
+
264
+ Connection and transaction handles must be open and have no active operation
265
+ or cursor.
266
+
267
+ Args:
268
+ sql: A SQL statement with positional placeholders such as $1 and $2.
269
+ params: Values bound to the placeholders in order.
270
+ source: Encoded parent tracing context, or None when no context is active.
271
+
272
+ Returns:
273
+ An awaitable that produces the affected-row count reported by Postgres.
274
+ Any rows returned by the statement are discarded.
275
+
276
+ Raises:
277
+ EncoreError: Acquiring a connection or executing the statement fails.
278
+ """
279
+ def is_closed(self, /) -> "bool":
280
+ """
281
+ Return whether this connection or transaction handle was consumed.
282
+
283
+ Returns:
284
+ True if the handle has been closed or transaction completion has started.
285
+ Returns False for database handles and handles that are currently borrowed.
286
+ """
287
+ def query(self, /, sql: str, params: Sequence[Any], source: bytes |None = None) -> "typing.Awaitable[PostgresCursor]":
288
+ """
289
+ Start a query and return an awaitable cursor.
290
+
291
+ Connection and transaction handles must be open and have no active operation
292
+ or cursor.
293
+
294
+ Args:
295
+ sql: A SQL statement with positional placeholders such as $1 and $2.
296
+ params: Values bound to the placeholders in order.
297
+ source: Encoded parent tracing context, or None when no context is active.
298
+
299
+ Returns:
300
+ An awaitable that produces a PostgresCursor. Exhaust or close the cursor
301
+ before reusing its connection or transaction.
302
+
303
+ Raises:
304
+ EncoreError: Acquiring a connection or executing the query fails.
305
+ """
306
+ def rollback(self, /) -> "typing.Awaitable[None]":
307
+ """
308
+ Roll back a transaction and consume its handle.
309
+
310
+ Requires an open transaction with no active operation or cursor.
311
+ Once completion starts, cancelling the await does not interrupt completion.
312
+ Any borrowed connection stays unavailable until completion finishes.
313
+
314
+ Returns:
315
+ An awaitable that completes when Postgres finishes rolling back.
316
+
317
+ Raises:
318
+ EncoreError: Rolling back fails.
319
+ """
320
+
321
+ @final
322
+ class PubSubMessage:
323
+ @property
324
+ def attributes(self, /) -> dict[str, str]:
325
+ """
326
+ The attributes supplied when publishing the message.
327
+ """
328
+ @property
329
+ def data(self, /) -> bytes:
330
+ """
331
+ The raw message payload, without JSON decoding.
332
+ """
333
+ @property
334
+ def delivery_attempt(self, /) -> int:
335
+ """
336
+ The delivery attempt, starting at one.
337
+ """
338
+ @property
339
+ def id(self, /) -> str:
340
+ """
341
+ The unique message id assigned by the cloud provider.
342
+ """
343
+ @property
344
+ def ordering_key(self, /) -> str |None:
345
+ """
346
+ The ordering key from the topic's configured attribute, if present.
347
+ """
348
+ @property
349
+ def publish_time(self, /) -> datetime:
350
+ """
351
+ The UTC publication time, or None if the provider did not supply it.
352
+ """
353
+
354
+ @final
355
+ class PubSubSubscription:
356
+ def subscribe(self, /) -> "typing.Awaitable[None]":
357
+ """
358
+ Consume messages on the calling asyncio loop until subscription shutdown.
359
+ Handler completion acknowledges a message; exceptions propagate to the core
360
+ so the provider can apply its retry policy.
361
+ """
362
+
363
+ @final
364
+ class PubSubSubscriptionConfig:
365
+ def __new__(cls, /, *, topic_name: str, subscription_name: str, handler: "typing.Callable[[PubSubMessage], typing.Awaitable[None]]") -> "PubSubSubscriptionConfig": ...
366
+
367
+ @final
368
+ class PubSubTopic:
369
+ def publish(self, /, payload: Sequence[int], attributes: dict[str, str] |None = None, source: bytes |None = None, *, ordering_key: str |None = None) -> "typing.Awaitable[str]":
370
+ """
371
+ Publish raw payload bytes with optional attributes and an explicit ordering key.
372
+ """
373
+
374
+ @final
375
+ class RedisDatabase:
376
+ def bitmap_bitcount(self, /, key: str, *, start: int |None = None, end: int |None = None, unit: str |None = None, source: bytes |None = None) -> "typing.Awaitable[int]": ...
377
+ def bitmap_bitop(self, /, operation: str, destination: str, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
378
+ def bitmap_bitpos(self, /, key: str, bit: bool, *, start: int |None = None, end: int |None = None, unit: str |None = None, source: bytes |None = None) -> "typing.Awaitable[int]": ...
379
+ def bitmap_getbit(self, /, key: str, offset: int, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
380
+ def bitmap_setbit(self, /, key: str, offset: int, value: bool, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
381
+ def connection_string(self, /) -> "str":
382
+ """
383
+ Direct server URL; external clients do not apply Encore key prefixes.
384
+ """
385
+ def generic_copy(self, /, key: str, destination: str, *, replace: bool = False, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
386
+ def generic_delete(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
387
+ def generic_exists(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
388
+ def generic_expire(self, /, key: str, seconds: int, *, condition: str |None = None, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
389
+ def generic_expireat(self, /, key: str, timestamp: int, *, condition: str |None = None, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
390
+ def generic_expiretime(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
391
+ def generic_persist(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
392
+ def generic_pexpire(self, /, key: str, milliseconds: int, *, condition: str |None = None, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
393
+ def generic_pexpireat(self, /, key: str, timestamp: int, *, condition: str |None = None, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
394
+ def generic_pexpiretime(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
395
+ def generic_pttl(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
396
+ def generic_rename(self, /, key: str, destination: str, *, source: bytes |None = None) -> "typing.Awaitable[None]": ...
397
+ def generic_renamenx(self, /, key: str, destination: str, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
398
+ def generic_scan(self, /, cursor: int, *, pattern: str |None = None, count: int |None = None, key_type: str |None = None, source: bytes |None = None) -> "typing.Awaitable[tuple[int, list[bytes]]]": ...
399
+ def generic_touch(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
400
+ def generic_ttl(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
401
+ def generic_type(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[str]": ...
402
+ def generic_unlink(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
403
+ def geo_geoadd(self, /, key: str, items: Sequence[tuple[float, float, bytes]], *, nx: bool = False, xx: bool = False, ch: bool = False, source: bytes |None = None) -> "typing.Awaitable[int]": ...
404
+ def geo_geodist(self, /, key: str, member1: bytes, member2: bytes, *, unit: str = "m", source: bytes |None = None) -> "typing.Awaitable[typing.Optional[float]]": ...
405
+ def geo_geohash(self, /, key: str, members: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[list[typing.Optional[bytes]]]": ...
406
+ def geo_geopos(self, /, key: str, members: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
407
+ def geo_georadius(self, /, key: str, longitude: float, latitude: float, radius: float, *, unit: str = "m", count: int |None = None, any: bool = False, order: str |None = None, withcoord: bool = False, withdist: bool = False, withhash: bool = False, store: str |None = None, storedist: str |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
408
+ def geo_georadiusbymember(self, /, key: str, member: bytes, radius: float, *, unit: str = "m", count: int |None = None, any: bool = False, order: str |None = None, withcoord: bool = False, withdist: bool = False, withhash: bool = False, store: str |None = None, storedist: str |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
409
+ def geo_geosearch(self, /, key: str, *, member: bytes |None = None, longitude: float |None = None, latitude: float |None = None, radius: float |None = None, width: float |None = None, height: float |None = None, unit: str = "m", count: int |None = None, any: bool = False, order: str |None = None, withcoord: bool = False, withdist: bool = False, withhash: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
410
+ def geo_geosearchstore(self, /, destination: str, key: str, *, member: bytes |None = None, longitude: float |None = None, latitude: float |None = None, radius: float |None = None, width: float |None = None, height: float |None = None, unit: str = "m", count: int |None = None, any: bool = False, order: str |None = None, storedist: bool = False, source: bytes |None = None) -> "typing.Awaitable[int]": ...
411
+ def hash_hdel(self, /, key: str, fields: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
412
+ def hash_hexists(self, /, key: str, field: str, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
413
+ def hash_hget(self, /, key: str, field: str, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
414
+ def hash_hgetall(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[dict[bytes, bytes]]": ...
415
+ def hash_hincrby(self, /, key: str, field: str, amount: int, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
416
+ def hash_hincrbyfloat(self, /, key: str, field: str, amount: float, *, source: bytes |None = None) -> "typing.Awaitable[float]": ...
417
+ def hash_hkeys(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[list[bytes]]": ...
418
+ def hash_hlen(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
419
+ def hash_hmget(self, /, key: str, fields: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[list[typing.Optional[bytes]]]": ...
420
+ def hash_hrandfield(self, /, key: str, *, count: int |None = None, withvalues: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
421
+ def hash_hscan(self, /, key: str, cursor: int, *, pattern: str |None = None, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[tuple[int, dict[bytes, bytes]]]": ...
422
+ def hash_hset(self, /, key: str, items: Sequence[tuple[str, bytes]], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
423
+ def hash_hsetnx(self, /, key: str, field: str, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
424
+ def hash_hvals(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[list[bytes]]": ...
425
+ def json_arrappend(self, /, key: str, path: str, values: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
426
+ def json_arrindex(self, /, key: str, path: str, value: str, *, start: int |None = None, stop: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
427
+ def json_arrinsert(self, /, key: str, path: str, index: int, values: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
428
+ def json_arrlen(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
429
+ def json_arrpop(self, /, key: str, *, path: str = "$", index: int = ..., source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
430
+ def json_arrtrim(self, /, key: str, path: str, start: int, stop: int, *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
431
+ def json_clear(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
432
+ def json_delete(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
433
+ def json_forget(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
434
+ def json_get(self, /, key: str, *, paths: Sequence[str] |None = None, indent: str |None = None, newline: str |None = None, space: str |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
435
+ def json_merge(self, /, key: str, path: str, value: str, *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
436
+ def json_mget(self, /, keys: Sequence[str], path: str, *, source: bytes |None = None) -> "typing.Awaitable[list[typing.Optional[bytes]]]": ...
437
+ def json_mset(self, /, items: Sequence[tuple[str, str, str]], *, source: bytes |None = None) -> "typing.Awaitable[None]": ...
438
+ def json_numincrby(self, /, key: str, path: str, number: float, *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
439
+ def json_nummultby(self, /, key: str, path: str, number: float, *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
440
+ def json_objkeys(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
441
+ def json_objlen(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
442
+ def json_set(self, /, key: str, path: str, value: str, *, condition: str |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
443
+ def json_strappend(self, /, key: str, path: str, value: str, *, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
444
+ def json_strlen(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
445
+ def json_toggle(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
446
+ def json_type(self, /, key: str, *, path: str = "$", source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
447
+ def list_lindex(self, /, key: str, index: int, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
448
+ def list_linsert(self, /, key: str, position: str, pivot: bytes, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
449
+ def list_llen(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
450
+ def list_lmove(self, /, key: str, destination: str, from_side: str, to_side: str, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
451
+ def list_lpop(self, /, key: str, *, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
452
+ def list_lpos(self, /, key: str, element: bytes, *, rank: int |None = None, count: int |None = None, maxlen: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
453
+ def list_lpush(self, /, key: str, values: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
454
+ def list_lpushx(self, /, key: str, values: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
455
+ def list_lrange(self, /, key: str, start: int, stop: int, *, source: bytes |None = None) -> "typing.Awaitable[list[bytes]]": ...
456
+ def list_lrem(self, /, key: str, count: int, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
457
+ def list_lset(self, /, key: str, index: int, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[None]": ...
458
+ def list_ltrim(self, /, key: str, start: int, stop: int, *, source: bytes |None = None) -> "typing.Awaitable[None]": ...
459
+ def list_rpop(self, /, key: str, *, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
460
+ def list_rpush(self, /, key: str, values: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
461
+ def list_rpushx(self, /, key: str, values: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
462
+ def pubsub_psubscribe(self, /, patterns: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[RedisSubscription]": ...
463
+ def pubsub_publish(self, /, channel: str, message: bytes, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
464
+ def pubsub_subscribe(self, /, channels: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[RedisSubscription]": ...
465
+ def read(self, /, *, primary: bool = False) -> "RedisDatabase":
466
+ """
467
+ All currently configured core clients connect to the primary. The flag
468
+ is accepted for API parity; replica routing belongs in the shared core.
469
+ """
470
+ def set_sadd(self, /, key: str, members: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
471
+ def set_scard(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
472
+ def set_sdiff(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[list[bytes]]": ...
473
+ def set_sdiffstore(self, /, destination: str, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
474
+ def set_sinter(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[list[bytes]]": ...
475
+ def set_sinterstore(self, /, destination: str, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
476
+ def set_sismember(self, /, key: str, member: bytes, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
477
+ def set_smembers(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[list[bytes]]": ...
478
+ def set_smismember(self, /, key: str, members: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[list[bool]]": ...
479
+ def set_smove(self, /, key: str, destination: str, member: bytes, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
480
+ def set_spop(self, /, key: str, *, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
481
+ def set_srandmember(self, /, key: str, *, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
482
+ def set_srem(self, /, key: str, members: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
483
+ def set_sscan(self, /, key: str, cursor: int, *, pattern: str |None = None, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[tuple[int, list[bytes]]]": ...
484
+ def set_sunion(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[list[bytes]]": ...
485
+ def set_sunionstore(self, /, destination: str, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
486
+ def sorted_set_zadd(self, /, key: str, items: Sequence[tuple[float, bytes]], *, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False, ch: bool = False, source: bytes |None = None) -> "typing.Awaitable[int]": ...
487
+ def sorted_set_zcard(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
488
+ def sorted_set_zcount(self, /, key: str, minimum: str, maximum: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
489
+ def sorted_set_zincrby(self, /, key: str, amount: float, member: bytes, *, source: bytes |None = None) -> "typing.Awaitable[float]": ...
490
+ def sorted_set_zinterstore(self, /, destination: str, keys: Sequence[str], *, weights: Sequence[float] |None = None, aggregate: str |None = None, source: bytes |None = None) -> "typing.Awaitable[int]": ...
491
+ def sorted_set_zpopmax(self, /, key: str, *, count: int = 1, source: bytes |None = None) -> "typing.Awaitable[list[tuple[bytes, float]]]": ...
492
+ def sorted_set_zpopmin(self, /, key: str, *, count: int = 1, source: bytes |None = None) -> "typing.Awaitable[list[tuple[bytes, float]]]": ...
493
+ def sorted_set_zrandmember(self, /, key: str, *, count: int |None = None, withscores: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
494
+ def sorted_set_zrange(self, /, key: str, start: int, stop: int, *, withscores: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
495
+ def sorted_set_zrangebyscore(self, /, key: str, minimum: str, maximum: str, *, withscores: bool = False, offset: int |None = None, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
496
+ def sorted_set_zrank(self, /, key: str, member: bytes, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[int]]": ...
497
+ def sorted_set_zrem(self, /, key: str, members: Sequence[bytes], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
498
+ def sorted_set_zremrangebyrank(self, /, key: str, start: int, stop: int, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
499
+ def sorted_set_zremrangebyscore(self, /, key: str, minimum: str, maximum: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
500
+ def sorted_set_zrevrange(self, /, key: str, start: int, stop: int, *, withscores: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
501
+ def sorted_set_zrevrank(self, /, key: str, member: bytes, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[int]]": ...
502
+ def sorted_set_zscan(self, /, key: str, cursor: int, *, pattern: str |None = None, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[tuple[int, list[tuple[bytes, float]]]]": ...
503
+ def sorted_set_zscore(self, /, key: str, member: bytes, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[float]]": ...
504
+ def sorted_set_zunionstore(self, /, destination: str, keys: Sequence[str], *, weights: Sequence[float] |None = None, aggregate: str |None = None, source: bytes |None = None) -> "typing.Awaitable[int]": ...
505
+ def stream_xack(self, /, key: str, group: str, ids: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
506
+ def stream_xadd(self, /, key: str, items: Sequence[tuple[str, bytes]], *, id: str = "*", nomkstream: bool = False, maxlen: int |None = None, minid: str |None = None, approximate: bool = False, limit: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
507
+ def stream_xautoclaim(self, /, key: str, group: str, consumer: str, min_idle_ms: int, start: str, *, count: int |None = None, justid: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
508
+ def stream_xclaim(self, /, key: str, group: str, consumer: str, min_idle_ms: int, ids: Sequence[str], *, idle_ms: int |None = None, time_ms: int |None = None, retrycount: int |None = None, force: bool = False, justid: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
509
+ def stream_xdel(self, /, key: str, ids: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
510
+ def stream_xgroup_create(self, /, key: str, group: str, *, id: str = "$", mkstream: bool = False, entries_read: int |None = None, source: bytes |None = None) -> "typing.Awaitable[None]": ...
511
+ def stream_xgroup_destroy(self, /, key: str, group: str, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
512
+ def stream_xinfo_stream(self, /, key: str, *, full: bool = False, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
513
+ def stream_xlen(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
514
+ def stream_xpending(self, /, key: str, group: str, *, start: str |None = None, end: str |None = None, count: int |None = None, consumer: str |None = None, idle_ms: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
515
+ def stream_xrange(self, /, key: str, start: str, end: str, *, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
516
+ def stream_xread(self, /, streams: Sequence[tuple[str, str]], *, count: int |None = None, block_ms: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
517
+ def stream_xreadgroup(self, /, group: str, consumer: str, streams: Sequence[tuple[str, str]], *, count: int |None = None, block_ms: int |None = None, noack: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
518
+ def stream_xrevrange(self, /, key: str, end: str, start: str, *, count: int |None = None, source: bytes |None = None) -> "typing.Awaitable[typing.Any]": ...
519
+ def stream_xtrim(self, /, key: str, *, maxlen: int |None = None, minid: str |None = None, approximate: bool = False, limit: int |None = None, source: bytes |None = None) -> "typing.Awaitable[int]": ...
520
+ def string_append(self, /, key: str, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
521
+ def string_decr(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
522
+ def string_decrby(self, /, key: str, amount: int, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
523
+ def string_get(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
524
+ def string_getdel(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
525
+ def string_getex(self, /, key: str, *, ex: int |None = None, px: int |None = None, exat: int |None = None, pxat: int |None = None, persist: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
526
+ def string_getrange(self, /, key: str, start: int, end: int, *, source: bytes |None = None) -> "typing.Awaitable[bytes]": ...
527
+ def string_incr(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
528
+ def string_incrby(self, /, key: str, amount: int, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
529
+ def string_incrbyfloat(self, /, key: str, amount: float, *, source: bytes |None = None) -> "typing.Awaitable[float]": ...
530
+ def string_mget(self, /, keys: Sequence[str], *, source: bytes |None = None) -> "typing.Awaitable[list[typing.Optional[bytes]]]": ...
531
+ def string_mset(self, /, items: Sequence[tuple[str, bytes]], *, source: bytes |None = None) -> "typing.Awaitable[None]": ...
532
+ def string_msetnx(self, /, items: Sequence[tuple[str, bytes]], *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
533
+ def string_psetex(self, /, key: str, milliseconds: int, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[None]": ...
534
+ def string_set(self, /, key: str, value: bytes, *, ex: int |None = None, px: int |None = None, exat: int |None = None, pxat: int |None = None, keepttl: bool = False, nx: bool = False, xx: bool = False, get: bool = False, source: bytes |None = None) -> "typing.Awaitable[typing.Optional[bytes]]": ...
535
+ def string_setex(self, /, key: str, seconds: int, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[None]": ...
536
+ def string_setnx(self, /, key: str, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[bool]": ...
537
+ def string_setrange(self, /, key: str, offset: int, value: bytes, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
538
+ def string_strlen(self, /, key: str, *, source: bytes |None = None) -> "typing.Awaitable[int]": ...
539
+ def write(self, /) -> "RedisDatabase": ...
540
+
541
+ @final
542
+ class RedisSubscription:
543
+ """
544
+ A dedicated Pub/Sub connection. close() interrupts a pending receive.
545
+ """
546
+ def close(self, /) -> "typing.Awaitable[None]": ...
547
+ def receive(self, /) -> "typing.Awaitable[typing.Optional[tuple[bytes, bytes]]]": ...
548
+
549
+ @final
550
+ class Runtime:
551
+ def __new__(cls, /) -> "Runtime": ...
552
+ def app_meta_json(self, /) -> "str":
553
+ """
554
+ Metadata about the running application, as a JSON document.
555
+
556
+ JSON rather than a tree of `#[pyclass]`es: the metadata is a small
557
+ document read once per process, and the typed, documented user-facing API
558
+ belongs in the pure-Python `encore.meta` package (which decodes this),
559
+ alongside the rest of the package's public surface.
560
+ """
561
+ def begin_shutdown(self, /, cooperative: bool = False) -> "None":
562
+ """
563
+ Start shutdown once and return immediately. The first call chooses the mode.
564
+ Cooperative shutdown waits for mark_application_drained before resource cleanup.
565
+ """
566
+ def bucket(self, /, name: str) -> "Bucket": ...
567
+ def cleanup(self, /) -> "typing.Awaitable[None]":
568
+ """
569
+ Wait until shutdown has reached or passed Cleanup. Call begin_shutdown first.
570
+ """
571
+ def completed(self, /) -> "typing.Awaitable[ShutdownResult]":
572
+ """
573
+ Wait for cleanup to finish, including after its deadline has elapsed.
574
+ Call begin_shutdown first. Cancelling this awaitable does not cancel cleanup.
575
+ """
576
+ def force_cleanup(self, /) -> "None":
577
+ """
578
+ Request resource cleanup without waiting for active work to drain.
579
+ Call begin_shutdown first, then await cleanup to observe the transition.
580
+ """
581
+ def get_metrics_registry(self, /) -> "MetricsRegistry":
582
+ """
583
+ Get the shared application metrics registry.
584
+ """
585
+ def mark_application_drained(self, /) -> "None":
586
+ """
587
+ Notify Encore that application work has drained. Repeated calls are harmless.
588
+ """
589
+ def phase(self, /) -> "ShutdownPhase":
590
+ """
591
+ Read the current shutdown phase, including before begin_shutdown.
592
+ """
593
+ def pubsub_subscription(self, /, config: PubSubSubscriptionConfig) -> "PubSubSubscription":
594
+ """
595
+ Resolve a declared subscription; consuming starts when subscribe is called.
596
+ """
597
+ def pubsub_topic(self, /, name: str) -> "PubSubTopic":
598
+ """
599
+ A handle to the named pub/sub topic, or an error if it isn't configured.
600
+ """
601
+ def redis_database(self, /, name: str) -> "RedisDatabase":
602
+ """
603
+ Look up a Redis database configured for this service.
604
+ """
605
+ def run_forever(self, /) -> "None":
606
+ """
607
+ Start draining infrastructure (pub/sub subscriptions, metrics export) on a
608
+ background thread, keeping the process serving until shutdown. Returns
609
+ immediately; the caller's own loop keeps the process alive.
610
+ """
611
+ def secret(self, /, name: str) -> "typing.Optional[Secret]":
612
+ """
613
+ A secret belonging to the service this process hosts, or `None` if it
614
+ isn't configured. A shared secret of the same name is deliberately not
615
+ consulted.
616
+ """
617
+ def shared_secret(self, /, name: str) -> "typing.Optional[Secret]":
618
+ """
619
+ An app-wide secret, readable from any service, or `None` if it isn't
620
+ configured. A service-scoped secret of the same name is deliberately not
621
+ consulted.
622
+ """
623
+ def sql_database(self, /, name: str) -> "PostgresHandle":
624
+ """
625
+ A handle to the named SQL database (looked up in the runtime config).
626
+ """
627
+ def started(self, /) -> "typing.Awaitable[None]":
628
+ """
629
+ Wait until shutdown has reached or passed Started. Call begin_shutdown first.
630
+ """
631
+ def telemetry(self, /) -> "Pipeline":
632
+ """
633
+ The telemetry pipeline's span lifecycle calls.
634
+ """
635
+ @staticmethod
636
+ def version() -> "str":
637
+ """
638
+ The version of the Encore runtime in use.
639
+ """
640
+
641
+ @final
642
+ class Secret:
643
+ def get(self, /) -> "str":
644
+ """
645
+ The secret's value as a UTF-8 string.
646
+ """
647
+ def get_bytes(self, /) -> "bytes":
648
+ """
649
+ The secret's raw value as bytes.
650
+ """
651
+
652
+ @final
653
+ class ShutdownPhase:
654
+ """
655
+ Current phase of Encore resource shutdown.
656
+ """
657
+ Cleanup: Final[ShutdownPhase]
658
+ Completed: Final[ShutdownPhase]
659
+ NotStarted: Final[ShutdownPhase]
660
+ Started: Final[ShutdownPhase]
661
+ def __eq__(self, value: object, /) -> bool: ...
662
+ def __int__(self, /) -> int: ...
663
+ def __ne__(self, value: object, /) -> bool: ...
664
+ def __repr__(self, /) -> str: ...
665
+
666
+ @final
667
+ class ShutdownResult:
668
+ """
669
+ Outcome of completed Encore resource cleanup.
670
+ """
671
+ Failed: Final[ShutdownResult]
672
+ Success: Final[ShutdownResult]
673
+ Timeout: Final[ShutdownResult]
674
+ def __eq__(self, value: object, /) -> bool: ...
675
+ def __int__(self, /) -> int: ...
676
+ def __ne__(self, value: object, /) -> bool: ...
677
+ def __repr__(self, /) -> str: ...
678
+
679
+ @final
680
+ class UploadOptions:
681
+ def __new__(cls, /, *, content_type: str |None = None, preconditions: UploadPreconditions |None = None) -> "UploadOptions": ...
682
+
683
+ @final
684
+ class UploadPreconditions:
685
+ def __new__(cls, /, *, not_exists: bool |None = None) -> "UploadPreconditions": ...
686
+
687
+ @final
688
+ class UploadStream:
689
+ def close(self, /) -> "typing.Awaitable[None]": ...
690
+ def finish(self, /) -> "typing.Awaitable[ObjectAttrs]": ...
691
+ def write(self, /, data: bytes) -> "typing.Awaitable[None]": ...
692
+
693
+ @final
694
+ class UploadUrlOptions:
695
+ def __new__(cls, /, *, ttl: int |None = None) -> "UploadUrlOptions": ...
696
+
697
+ class EncoreError(RuntimeError): ...
698
+ class ObjectsError(EncoreError): ...
699
+ class ObjectNotFound(ObjectsError): ...
700
+ class PreconditionFailed(ObjectsError): ...
701
+ class InvalidArgument(ObjectsError): ...
702
+
703
+ def encode_log(level: int, time_unix_nanos: int, message: str, *, logger: str |None = None, span_ctx: bytes |None = None, exception_type: str |None = None, exception_message: str |None = None, exception_stacktrace: str |None = None, code_function: str |None = None, code_file: str |None = None, code_line: int = 0, code_column: int = 0, runtime_target: str |None = None, attrs_json: str |None = None) -> "str":
704
+ """
705
+ One log record as a line in the Encore log format, without the newline,
706
+ for the `logging` handler to print: `level` the OpenTelemetry severity
707
+ number (1–24; 0 none), `time_unix_nanos` 0 for now, `span_ctx` the
708
+ span's 25-byte context, `exception_*` the exception (the stack trace in
709
+ Python's format), `code_*` the caller, `runtime_target` the runtime
710
+ module of a line of the runtime's own (logged under the runtime's logger,
711
+ in place of `logger`), `attrs_json` a JSON object of the user's
712
+ attributes. `None`, an empty string, and 0 are none. An attribute named
713
+ like a reserved key is that field when valid, `raw.<key>` otherwise; one
714
+ named like a key of the record's own fields is `raw.<key>`. Needs no
715
+ runtime.
716
+ """
717
+
718
+ def flush_runtime_log(timeout: float) -> "int":
719
+ """
720
+ Waits, up to `timeout` seconds, for the handler to take the lines queued
721
+ so far. Returns how many lines it lost: dropped on a full queue, and
722
+ still queued at the timeout.
723
+ """
724
+
725
+ def set_runtime_log_handler(handler: Any |None) -> "None":
726
+ """
727
+ Hands the runtime's own log lines to `handler(level, target, message,
728
+ fields_json, span_ctx)`, or drops them for `None`: `level` 1 ERROR to 5
729
+ TRACE, `fields_json` a JSON object of key-values (`exception.*`
730
+ included), `span_ctx` the current span's 25-byte context or `None`.
731
+ Lines logged before the first call are handed over first. The handler
732
+ runs on a dedicated thread; its exceptions are unraisable. Up to 1024
733
+ lines wait for it; more are dropped, counted by `flush_runtime_log`.
734
+ """