mirror of
https://github.com/element-hq/synapse.git
synced 2026-12-03 07:14:33 +00:00
28 lines
956 B
Python
28 lines
956 B
Python
from synapse.server import HomeServer
|
|
|
|
class RustRuntime:
|
|
"""The per-homeserver state for the Rust side of Synapse.
|
|
|
|
Holds the tokio thread pool (started lazily on first use, shut down with the
|
|
Homeserver). Rust classes that need them take this as a constructor
|
|
argument. Get it from `hs.get_rust_runtime()`.
|
|
"""
|
|
|
|
def __init__(
|
|
self,
|
|
hs: HomeServer,
|
|
worker_threads: int = 4,
|
|
) -> None: ...
|
|
def time_msec(self) -> int:
|
|
"""Test utility only. Normal code should use
|
|
`hs.get_clock().time_msec()`.
|
|
|
|
The current time in milliseconds since the Unix epoch, as the Rust side
|
|
sees it. This and `Clock.time_msec()` agree because both read the system
|
|
clock, `clock_gettime(CLOCK_REALTIME)` on Linux.
|
|
"""
|
|
|
|
def set_virtual_time_msec(millis: int) -> None:
|
|
"""Pin the Rust clock to the given time. Only for tests, which run
|
|
against a virtual reactor clock."""
|