PyEventEngine 0.6.2__cp315-cp315-win_amd64.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.
- event_engine/__infra__.pxd +2 -0
- event_engine/__init__.pxd +2 -0
- event_engine/__init__.py +62 -0
- event_engine/base/__infra__.pxd +9 -0
- event_engine/base/__init__.pxd +9 -0
- event_engine/base/__init__.py +31 -0
- event_engine/base/c_allocator_protocol.c +14310 -0
- event_engine/base/c_allocator_protocol.cp315-win_amd64.pyd +0 -0
- event_engine/base/c_allocator_protocol.h +23 -0
- event_engine/base/c_allocator_protocol.pxd +31 -0
- event_engine/base/c_allocator_protocol.pyx +193 -0
- event_engine/capi/__infra__.pxd +189 -0
- event_engine/capi/__init__.pxd +189 -0
- event_engine/capi/__init__.py +84 -0
- event_engine/capi/c_engine.c +32542 -0
- event_engine/capi/c_engine.cp315-win_amd64.pyd +0 -0
- event_engine/capi/c_engine.h +393 -0
- event_engine/capi/c_engine.pxd +84 -0
- event_engine/capi/c_engine.pyi +478 -0
- event_engine/capi/c_engine.pyx +673 -0
- event_engine/capi/c_event.c +22826 -0
- event_engine/capi/c_event.cp315-win_amd64.pyd +0 -0
- event_engine/capi/c_event.h +342 -0
- event_engine/capi/c_event.pxd +159 -0
- event_engine/capi/c_event.pyi +265 -0
- event_engine/capi/c_event.pyx +444 -0
- event_engine/capi/c_topic.c +34545 -0
- event_engine/capi/c_topic.cp315-win_amd64.pyd +0 -0
- event_engine/capi/c_topic.h +1007 -0
- event_engine/capi/c_topic.pxd +147 -0
- event_engine/capi/c_topic.pyi +644 -0
- event_engine/capi/c_topic.pyx +818 -0
- event_engine/capi/fallback_engine.py +707 -0
- event_engine/config_view.c +10271 -0
- event_engine/config_view.cp315-win_amd64.pyd +0 -0
- event_engine/config_view.pyx +55 -0
- event_engine/includes/event_engine/base/c_allocator_protocol.c +14310 -0
- event_engine/includes/event_engine/base/c_allocator_protocol.h +23 -0
- event_engine/includes/event_engine/capi/c_engine.c +32542 -0
- event_engine/includes/event_engine/capi/c_engine.h +393 -0
- event_engine/includes/event_engine/capi/c_event.c +22826 -0
- event_engine/includes/event_engine/capi/c_event.h +342 -0
- event_engine/includes/event_engine/capi/c_topic.c +34545 -0
- event_engine/includes/event_engine/capi/c_topic.h +1007 -0
- event_engine/includes/event_engine/config_view.c +10271 -0
- event_engine/native/__init__.py +60 -0
- event_engine/native/_event.py +420 -0
- event_engine/native/_topic.py +171 -0
- event_engine/native/engine.py +793 -0
- event_engine/native/event.py +469 -0
- event_engine/native/topic.py +943 -0
- pyeventengine-0.6.2.dist-info/METADATA +189 -0
- pyeventengine-0.6.2.dist-info/RECORD +56 -0
- pyeventengine-0.6.2.dist-info/WHEEL +5 -0
- pyeventengine-0.6.2.dist-info/licenses/LICENSE +21 -0
- pyeventengine-0.6.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
from collections.abc import Callable, Iterator
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from logging import Logger
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from ..base.c_strmap import StrMap
|
|
7
|
+
from .c_event import MessagePayload, EventHook
|
|
8
|
+
from .c_topic import Topic
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Full(Exception):
|
|
12
|
+
"""Raised when attempting to publish to a full event queue."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Empty(Exception):
|
|
16
|
+
"""Raised when attempting to retrieve from an empty event queue."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class EventEngine:
|
|
20
|
+
"""
|
|
21
|
+
High‑performance, topic‑driven event dispatcher backed by a lock–aware C implementation.
|
|
22
|
+
|
|
23
|
+
The engine manages an internal message queue and dispatches events to registered handlers
|
|
24
|
+
based on topic matching rules. Internally, it uses the following C components:
|
|
25
|
+
- A pthread-based event loop that consumes messages and triggers callbacks.
|
|
26
|
+
- A custom payload allocator to avoid frequent ``malloc``/``free`` in performance-critical paths.
|
|
27
|
+
- Two ``StrMap`` instances:
|
|
28
|
+
* One for **exact** topic matches (literal key equality).
|
|
29
|
+
* One for **generic** topic matches (pattern-based, handled by ``Topic``).
|
|
30
|
+
|
|
31
|
+
These C structures are allocated during initialization and are managed automatically.
|
|
32
|
+
|
|
33
|
+
**Matching priority**: exact topic matches take precedence over generic matches.
|
|
34
|
+
Exact matches are based on the topic’s internal literal key (not its string representation).
|
|
35
|
+
Generic matches are evaluated by testing whether the published topic matches a registered pattern.
|
|
36
|
+
|
|
37
|
+
Notes:
|
|
38
|
+
Two ``Topic`` instances may have identical string representations but different internal structures
|
|
39
|
+
(e.g., different numbers of parts). In such cases, they are considered distinct exact topics.
|
|
40
|
+
|
|
41
|
+
Example:
|
|
42
|
+
|
|
43
|
+
>>> t1 = Topic.join(['Realtime', 'TickData', '600010.SH'])
|
|
44
|
+
>>> t2 = Topic.join(['Realtime', 'TickData', '600010', 'SH'])
|
|
45
|
+
|
|
46
|
+
Although ``str(t1) == str(t2)``, they have different part counts and thus different literal keys.
|
|
47
|
+
If both were somehow registered (which the Python API prevents), only one hook would be triggered,
|
|
48
|
+
with undefined selection priority.
|
|
49
|
+
|
|
50
|
+
Topic construction validity is the user’s responsibility. Use a ``TopicSet`` for robust topic management.
|
|
51
|
+
|
|
52
|
+
Attributes:
|
|
53
|
+
capacity (int): Maximum number of messages the internal queue can hold.
|
|
54
|
+
logger (Logger): Logger instance used for diagnostics.
|
|
55
|
+
active (bool): Indicates whether the engine is currently running.
|
|
56
|
+
seq_id (int): Monotonically increasing sequence ID for published messages.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
capacity: int
|
|
60
|
+
logger: Logger
|
|
61
|
+
active: bool
|
|
62
|
+
seq_id: int
|
|
63
|
+
|
|
64
|
+
def __init__(self, capacity: int = ..., logger: Logger = None) -> None:
|
|
65
|
+
"""
|
|
66
|
+
Initialize an ``EventEngine``.
|
|
67
|
+
|
|
68
|
+
Allocates the following internal C resources:
|
|
69
|
+
- A fixed-capacity message queue.
|
|
70
|
+
- A high-performance payload allocator.
|
|
71
|
+
- Two ``StrMap`` instances for exact and generic topic routing.
|
|
72
|
+
|
|
73
|
+
It is recommended to use singleton instances to minimize resource overhead.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
capacity: Maximum number of pending messages.
|
|
77
|
+
logger: Optional logger. If ``None``, a default logger is created.
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
MemoryError: If internal C structures fail to allocate.
|
|
81
|
+
"""
|
|
82
|
+
...
|
|
83
|
+
|
|
84
|
+
def __len__(self) -> int:
|
|
85
|
+
"""
|
|
86
|
+
Return the total number of registered topics (both exact and generic).
|
|
87
|
+
"""
|
|
88
|
+
...
|
|
89
|
+
|
|
90
|
+
def __getitem__(self, topic: Topic) -> list[EventHook]:
|
|
91
|
+
"""
|
|
92
|
+
Retrieve the list of ``EventHook`` instances that can be triggered with the given topic.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
topic: The topic to look up (exact or generic).
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
A list of ``EventHook`` instances registered for the topic.
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
KeyError: If no hooks are registered for the given topic.
|
|
102
|
+
"""
|
|
103
|
+
...
|
|
104
|
+
|
|
105
|
+
def activate(self):
|
|
106
|
+
"""
|
|
107
|
+
Activate the event engine.
|
|
108
|
+
|
|
109
|
+
This method is called automatically when ``start`` is invoked.
|
|
110
|
+
It can also be called manually to prepare the engine for operation.
|
|
111
|
+
"""
|
|
112
|
+
...
|
|
113
|
+
|
|
114
|
+
def deactivate(self) -> None:
|
|
115
|
+
"""
|
|
116
|
+
Deactivate the event engine.
|
|
117
|
+
|
|
118
|
+
This method is called automatically when ``stop`` is invoked.
|
|
119
|
+
It can also be called manually to halt the engine's operation.
|
|
120
|
+
"""
|
|
121
|
+
...
|
|
122
|
+
|
|
123
|
+
def run(self) -> None:
|
|
124
|
+
"""
|
|
125
|
+
Run the event loop in the current thread (blocking).
|
|
126
|
+
"""
|
|
127
|
+
...
|
|
128
|
+
|
|
129
|
+
def start(self) -> None:
|
|
130
|
+
"""
|
|
131
|
+
Start the event loop in a dedicated background thread.
|
|
132
|
+
|
|
133
|
+
If the engine is already running, this method has no effect.
|
|
134
|
+
"""
|
|
135
|
+
...
|
|
136
|
+
|
|
137
|
+
def stop(self) -> None:
|
|
138
|
+
"""
|
|
139
|
+
Stop the event loop and wait for the background thread to terminate.
|
|
140
|
+
|
|
141
|
+
If the engine is already stopped, this method has no effect.
|
|
142
|
+
"""
|
|
143
|
+
...
|
|
144
|
+
|
|
145
|
+
def clear(self) -> None:
|
|
146
|
+
"""
|
|
147
|
+
Unregister all event hooks.
|
|
148
|
+
|
|
149
|
+
Notes:
|
|
150
|
+
This method only works when the engine is stopped. If called while running,
|
|
151
|
+
an error is logged and no action is taken.
|
|
152
|
+
"""
|
|
153
|
+
...
|
|
154
|
+
|
|
155
|
+
def get(self, block: bool = True, max_spin: int = ..., timeout: float = 0.0) -> MessagePayload:
|
|
156
|
+
"""
|
|
157
|
+
Retrieve an event from the internal queue.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
block: If ``True``, wait until an event is available.
|
|
161
|
+
max_spin: Maximum number of spin-loop iterations before blocking (hybrid wait strategy).
|
|
162
|
+
timeout: Maximum wait time in seconds when blocking (``0.0`` means indefinite wait).
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
A ``MessagePayload`` instance that owns its internal buffer, ``args``, and ``kwargs`` to prevent memory leaks.
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
Empty: If ``block=False`` and the queue is empty.
|
|
169
|
+
"""
|
|
170
|
+
...
|
|
171
|
+
|
|
172
|
+
def put(self, topic: Topic, *args, block: bool = True, max_spin: int = ..., timeout: float = 0.0, **kwargs) -> None:
|
|
173
|
+
"""
|
|
174
|
+
Publish an event to the queue (convenience alias for ``publish``).
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
topic: Must be an **exact** ``Topic`` (i.e., ``topic.is_exact`` must be ``True``).
|
|
178
|
+
*args: Positional arguments for the event.
|
|
179
|
+
block: If ``True``, wait if the queue is full.
|
|
180
|
+
max_spin: Spin count before blocking (hybrid strategy).
|
|
181
|
+
timeout: Maximum wait time in seconds when blocking (``0.0`` = indefinite).
|
|
182
|
+
**kwargs: Keyword arguments for the event.
|
|
183
|
+
|
|
184
|
+
Raises:
|
|
185
|
+
Full: If ``block=False`` and the queue is full.
|
|
186
|
+
ValueError: If ``topic`` is not an exact topic.
|
|
187
|
+
"""
|
|
188
|
+
...
|
|
189
|
+
|
|
190
|
+
def publish(self, topic: Topic, args: tuple, kwargs: dict, block: bool = True, timeout: float = 0.0) -> None:
|
|
191
|
+
"""
|
|
192
|
+
Publish an event to the queue.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
topic: Must be an **exact** ``Topic`` (i.e., ``topic.is_exact`` must be ``True``).
|
|
196
|
+
args: Positional arguments for the event.
|
|
197
|
+
kwargs: Keyword arguments for the event.
|
|
198
|
+
block: If ``True``, wait if the queue is full.
|
|
199
|
+
timeout: Maximum wait time in seconds when blocking (``0.0`` = indefinite).
|
|
200
|
+
|
|
201
|
+
Raises:
|
|
202
|
+
Full: If ``block=False`` and the queue is full.
|
|
203
|
+
ValueError: If ``topic`` is not an exact topic.
|
|
204
|
+
"""
|
|
205
|
+
...
|
|
206
|
+
|
|
207
|
+
def get_hook(self, topic: Topic) -> EventHook:
|
|
208
|
+
"""
|
|
209
|
+
Retrieve the ``EventHook`` associated with a topic.
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
topic: The topic to look up (exact or generic).
|
|
213
|
+
|
|
214
|
+
Returns:
|
|
215
|
+
The ``EventHook`` registered for the topic.
|
|
216
|
+
|
|
217
|
+
Raises:
|
|
218
|
+
KeyError: If no hook is registered for the given topic.
|
|
219
|
+
"""
|
|
220
|
+
...
|
|
221
|
+
|
|
222
|
+
def register_hook(self, hook: EventHook) -> None:
|
|
223
|
+
"""
|
|
224
|
+
Register an ``EventHook`` for its associated topic.
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
hook: The hook to register.
|
|
228
|
+
|
|
229
|
+
Raises:
|
|
230
|
+
KeyError: If a hook is already registered for the same topic (exact or generic).
|
|
231
|
+
"""
|
|
232
|
+
...
|
|
233
|
+
|
|
234
|
+
def unregister_hook(self, topic: Topic) -> EventHook:
|
|
235
|
+
"""
|
|
236
|
+
Unregister and return the ``EventHook`` associated with a topic.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
topic: The topic to unregister.
|
|
240
|
+
|
|
241
|
+
Returns:
|
|
242
|
+
The unregistered ``EventHook``.
|
|
243
|
+
|
|
244
|
+
Raises:
|
|
245
|
+
KeyError: If no hook is registered for the given topic.
|
|
246
|
+
"""
|
|
247
|
+
...
|
|
248
|
+
|
|
249
|
+
def register_handler(self, topic: Topic, handler: Callable[..., Any], deduplicate: bool = False) -> None:
|
|
250
|
+
"""
|
|
251
|
+
Register a Python callable as a handler for a topic.
|
|
252
|
+
|
|
253
|
+
Args:
|
|
254
|
+
topic: The topic to register the handler for (can be exact or generic).
|
|
255
|
+
handler: The callable to register.
|
|
256
|
+
deduplicate: If ``True``, skip registration if the handler is already present in the target ``EventHook``.
|
|
257
|
+
"""
|
|
258
|
+
...
|
|
259
|
+
|
|
260
|
+
def unregister_handler(self, topic: Topic, handler: Callable[..., Any]) -> None:
|
|
261
|
+
"""
|
|
262
|
+
Unregister a handler for a topic.
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
topic: The topic (exact or generic) to unregister the handler from.
|
|
266
|
+
handler: The callable to remove.
|
|
267
|
+
|
|
268
|
+
Raises:
|
|
269
|
+
KeyError: If no ``EventHook`` is registered for the given topic.
|
|
270
|
+
|
|
271
|
+
Notes:
|
|
272
|
+
- If the ``EventHook`` exists but the handler is not found, no exception is raised.
|
|
273
|
+
- If the handler removal leaves the ``EventHook`` empty, the hook itself is automatically unregistered.
|
|
274
|
+
"""
|
|
275
|
+
...
|
|
276
|
+
|
|
277
|
+
def event_hooks(self) -> Iterator[EventHook]:
|
|
278
|
+
"""
|
|
279
|
+
Iterate over all registered ``EventHook`` instances.
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
An iterator of ``EventHook`` objects.
|
|
283
|
+
"""
|
|
284
|
+
...
|
|
285
|
+
|
|
286
|
+
def topics(self) -> Iterator[Topic]:
|
|
287
|
+
"""
|
|
288
|
+
Iterate over all registered topics (both exact and generic).
|
|
289
|
+
|
|
290
|
+
Returns:
|
|
291
|
+
An iterator of ``Topic`` instances.
|
|
292
|
+
"""
|
|
293
|
+
...
|
|
294
|
+
|
|
295
|
+
def items(self) -> Iterator[tuple[Topic, EventHook]]:
|
|
296
|
+
"""
|
|
297
|
+
Iterate over all registered (topic, hook) pairs.
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
An iterator of ``(Topic, EventHook)`` tuples.
|
|
301
|
+
"""
|
|
302
|
+
...
|
|
303
|
+
|
|
304
|
+
@property
|
|
305
|
+
def capacity(self) -> int:
|
|
306
|
+
"""
|
|
307
|
+
Capacity (maximum number of ``MessagePayload`` instances) of the internal message queue.
|
|
308
|
+
"""
|
|
309
|
+
...
|
|
310
|
+
|
|
311
|
+
@property
|
|
312
|
+
def occupied(self) -> int:
|
|
313
|
+
"""
|
|
314
|
+
Current number of pending messages in the internal queue.
|
|
315
|
+
"""
|
|
316
|
+
...
|
|
317
|
+
|
|
318
|
+
@property
|
|
319
|
+
def exact_topic_hook_map(self) -> StrMap | dict[Topic, EventHook]:
|
|
320
|
+
"""
|
|
321
|
+
StrMap of exact topic to ``EventHook`` mappings.
|
|
322
|
+
"""
|
|
323
|
+
|
|
324
|
+
@property
|
|
325
|
+
def generic_topic_hook_map(self) -> StrMap | dict[Topic, EventHook]:
|
|
326
|
+
"""
|
|
327
|
+
StrMap of generic topic to ``EventHook`` mappings.
|
|
328
|
+
"""
|
|
329
|
+
...
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class EventEngineEx(EventEngine):
|
|
333
|
+
"""
|
|
334
|
+
Extended ``EventEngine`` with built-in timer support.
|
|
335
|
+
|
|
336
|
+
Timer events are published periodically to specified topics, enabling time-driven workflows
|
|
337
|
+
(e.g., heartbeats, scheduled tasks).
|
|
338
|
+
|
|
339
|
+
Attributes:
|
|
340
|
+
capacity (int): Capacity of the internal message queue.
|
|
341
|
+
logger (Logger): Logger instance.
|
|
342
|
+
"""
|
|
343
|
+
|
|
344
|
+
def __init__(self, capacity: int = ..., logger: Logger = None) -> None:
|
|
345
|
+
"""
|
|
346
|
+
Initialize an ``EventEngineEx``.
|
|
347
|
+
|
|
348
|
+
Args:
|
|
349
|
+
capacity: Maximum number of pending messages.
|
|
350
|
+
logger: Optional logger. If ``None``, a default logger is used.
|
|
351
|
+
|
|
352
|
+
Raises:
|
|
353
|
+
MemoryError: If internal C structures fail to allocate.
|
|
354
|
+
"""
|
|
355
|
+
...
|
|
356
|
+
|
|
357
|
+
def run_timer(self, interval: float, topic: Topic, activate_time: datetime | None = None) -> None:
|
|
358
|
+
"""
|
|
359
|
+
Run a blocking timer loop that periodically publishes to a topic.
|
|
360
|
+
|
|
361
|
+
Args:
|
|
362
|
+
interval: Publication interval in seconds.
|
|
363
|
+
topic: The topic to publish timer events to.
|
|
364
|
+
activate_time: Time at which the timer should start. If ``None``, starts immediately.
|
|
365
|
+
|
|
366
|
+
Raises:
|
|
367
|
+
RuntimeError: If engine is not activated.
|
|
368
|
+
"""
|
|
369
|
+
...
|
|
370
|
+
|
|
371
|
+
def minute_timer(self, topic: Topic) -> None:
|
|
372
|
+
"""
|
|
373
|
+
Run a blocking timer that publishes to a topic once per minute (on the minute).
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
topic: The topic to publish timer events to.
|
|
377
|
+
|
|
378
|
+
Raises:
|
|
379
|
+
RuntimeError: If engine is not activated.
|
|
380
|
+
"""
|
|
381
|
+
...
|
|
382
|
+
|
|
383
|
+
def second_timer(self, topic: Topic) -> None:
|
|
384
|
+
"""
|
|
385
|
+
Run a blocking timer that publishes to a topic once per second.
|
|
386
|
+
|
|
387
|
+
Args:
|
|
388
|
+
topic: The topic to publish timer events to.
|
|
389
|
+
|
|
390
|
+
Raises:
|
|
391
|
+
RuntimeError: If engine is not activated.
|
|
392
|
+
"""
|
|
393
|
+
...
|
|
394
|
+
|
|
395
|
+
def get_timer(self, interval: float, activate_time: datetime | None = None) -> Topic:
|
|
396
|
+
"""
|
|
397
|
+
Start a background timer thread and return its associated topic.
|
|
398
|
+
|
|
399
|
+
The engine automatically publishes a message to this topic at each interval.
|
|
400
|
+
Will not start multiple timers with the same interval.
|
|
401
|
+
|
|
402
|
+
Args:
|
|
403
|
+
interval: Timer interval in seconds.
|
|
404
|
+
activate_time: Time to start the timer. If ``None``, starts immediately.
|
|
405
|
+
|
|
406
|
+
Returns:
|
|
407
|
+
A unique ``Topic`` representing the timer stream.
|
|
408
|
+
|
|
409
|
+
Raises:
|
|
410
|
+
RuntimeError: If engine is not activated.
|
|
411
|
+
"""
|
|
412
|
+
...
|
|
413
|
+
|
|
414
|
+
def stop(self) -> None:
|
|
415
|
+
"""
|
|
416
|
+
Stop the event engine and all associated timer threads.
|
|
417
|
+
"""
|
|
418
|
+
...
|
|
419
|
+
|
|
420
|
+
def clear(self) -> None:
|
|
421
|
+
"""
|
|
422
|
+
Unregister all event hooks and stop all active timer threads.
|
|
423
|
+
"""
|
|
424
|
+
...
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
class EngineTestToolkit:
|
|
428
|
+
"""Relays internal C message-queue / hook-map state to Python for test validation.
|
|
429
|
+
|
|
430
|
+
Note:
|
|
431
|
+
Test-only class. Not declared in any ``.pxd``; not part of the
|
|
432
|
+
public package API.
|
|
433
|
+
"""
|
|
434
|
+
|
|
435
|
+
@staticmethod
|
|
436
|
+
def get_mq_capacity(engine: EventEngine) -> int:
|
|
437
|
+
"""Capacity of the engine's C message queue."""
|
|
438
|
+
...
|
|
439
|
+
|
|
440
|
+
@staticmethod
|
|
441
|
+
def get_mq_head(engine: EventEngine) -> int:
|
|
442
|
+
"""Head index of the engine's C message queue."""
|
|
443
|
+
...
|
|
444
|
+
|
|
445
|
+
@staticmethod
|
|
446
|
+
def get_mq_tail(engine: EventEngine) -> int:
|
|
447
|
+
"""Tail index of the engine's C message queue."""
|
|
448
|
+
...
|
|
449
|
+
|
|
450
|
+
@staticmethod
|
|
451
|
+
def get_mq_count(engine: EventEngine) -> int:
|
|
452
|
+
"""Occupancy counter of the engine's C message queue."""
|
|
453
|
+
...
|
|
454
|
+
|
|
455
|
+
@staticmethod
|
|
456
|
+
def get_exact_hook_map_size(engine: EventEngine) -> int:
|
|
457
|
+
"""Number of entries in the exact-topic hook bytemap."""
|
|
458
|
+
...
|
|
459
|
+
|
|
460
|
+
@staticmethod
|
|
461
|
+
def get_generic_hook_map_size(engine: EventEngine) -> int:
|
|
462
|
+
"""Number of entries in the generic-topic hook bytemap."""
|
|
463
|
+
...
|
|
464
|
+
|
|
465
|
+
@staticmethod
|
|
466
|
+
def get_exact_hook_map_keys(engine: EventEngine) -> list[str]:
|
|
467
|
+
"""Keys of all entries in the exact-topic hook bytemap."""
|
|
468
|
+
...
|
|
469
|
+
|
|
470
|
+
@staticmethod
|
|
471
|
+
def get_generic_hook_map_keys(engine: EventEngine) -> list[str]:
|
|
472
|
+
"""Keys of all entries in the generic-topic hook bytemap."""
|
|
473
|
+
...
|
|
474
|
+
|
|
475
|
+
@staticmethod
|
|
476
|
+
def bench_mq_put_get(n: int, capacity: int = ...) -> float:
|
|
477
|
+
"""Average seconds per put/get round trip on a raw C message queue."""
|
|
478
|
+
...
|