PyEventEngine 0.6.0.post3__cp314-cp314t-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.
Files changed (52) hide show
  1. event_engine/__infra__.pxd +2 -0
  2. event_engine/__init__.pxd +2 -0
  3. event_engine/__init__.py +37 -0
  4. event_engine/base/__infra__.pxd +9 -0
  5. event_engine/base/__init__.pxd +9 -0
  6. event_engine/base/__init__.py +82 -0
  7. event_engine/base/c_allocator_protocol.c +10825 -0
  8. event_engine/base/c_allocator_protocol.cp314t-win_amd64.pyd +0 -0
  9. event_engine/base/c_allocator_protocol.h +23 -0
  10. event_engine/base/c_allocator_protocol.pxd +31 -0
  11. event_engine/base/c_allocator_protocol.pyx +99 -0
  12. event_engine/capi/__infra__.pxd +189 -0
  13. event_engine/capi/__init__.pxd +189 -0
  14. event_engine/capi/__init__.py +84 -0
  15. event_engine/capi/c_engine.c +28719 -0
  16. event_engine/capi/c_engine.cp314t-win_amd64.pyd +0 -0
  17. event_engine/capi/c_engine.h +393 -0
  18. event_engine/capi/c_engine.pxd +84 -0
  19. event_engine/capi/c_engine.pyi +424 -0
  20. event_engine/capi/c_engine.pyx +560 -0
  21. event_engine/capi/c_event.c +19929 -0
  22. event_engine/capi/c_event.cp314t-win_amd64.pyd +0 -0
  23. event_engine/capi/c_event.h +342 -0
  24. event_engine/capi/c_event.pxd +159 -0
  25. event_engine/capi/c_event.pyi +226 -0
  26. event_engine/capi/c_event.pyx +387 -0
  27. event_engine/capi/c_topic.c +30986 -0
  28. event_engine/capi/c_topic.cp314t-win_amd64.pyd +0 -0
  29. event_engine/capi/c_topic.h +1007 -0
  30. event_engine/capi/c_topic.pxd +147 -0
  31. event_engine/capi/c_topic.pyi +580 -0
  32. event_engine/capi/c_topic.pyx +725 -0
  33. event_engine/capi/fallback_engine.py +670 -0
  34. event_engine/includes/event_engine/base/c_allocator_protocol.c +10825 -0
  35. event_engine/includes/event_engine/base/c_allocator_protocol.h +23 -0
  36. event_engine/includes/event_engine/capi/c_engine.c +28719 -0
  37. event_engine/includes/event_engine/capi/c_engine.h +393 -0
  38. event_engine/includes/event_engine/capi/c_event.c +19929 -0
  39. event_engine/includes/event_engine/capi/c_event.h +342 -0
  40. event_engine/includes/event_engine/capi/c_topic.c +30986 -0
  41. event_engine/includes/event_engine/capi/c_topic.h +1007 -0
  42. event_engine/native/__init__.py +60 -0
  43. event_engine/native/_event.py +420 -0
  44. event_engine/native/_topic.py +171 -0
  45. event_engine/native/engine.py +746 -0
  46. event_engine/native/event.py +467 -0
  47. event_engine/native/topic.py +945 -0
  48. pyeventengine-0.6.0.post3.dist-info/METADATA +189 -0
  49. pyeventengine-0.6.0.post3.dist-info/RECORD +52 -0
  50. pyeventengine-0.6.0.post3.dist-info/WHEEL +5 -0
  51. pyeventengine-0.6.0.post3.dist-info/licenses/LICENSE +21 -0
  52. pyeventengine-0.6.0.post3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,23 @@
1
+ #ifndef C_EVENT_ENGINE_ALLOCATOR_PROTOCOL_H
2
+ #define C_EVENT_ENGINE_ALLOCATOR_PROTOCOL_H
3
+
4
+ /**
5
+ * @brief EventEngine-local allocator protocol header.
6
+ *
7
+ * Wraps PyCyBase's allocator_protocol with an EE_LOCAL_ONLY compile-time
8
+ * switch. When EE_LOCAL_ONLY is 1 (default, thread-local engine), only the
9
+ * heap-allocator branch is available and SHM is excluded. Set to 0 to
10
+ * enable the full shared-memory allocator stack.
11
+ */
12
+
13
+ #ifndef EE_LOCAL_ONLY
14
+ #define EE_LOCAL_ONLY 1
15
+ #endif
16
+
17
+ #include <cbase/allocator_protocol/c_allocator_protocol.h>
18
+
19
+ #if !EE_LOCAL_ONLY
20
+ #include <cbase/allocator_protocol/c_shm_comp.h>
21
+ #endif
22
+
23
+ #endif /* C_EVENT_ENGINE_ALLOCATOR_PROTOCOL_H */
@@ -0,0 +1,31 @@
1
+ from libcpp cimport bool as c_bool
2
+
3
+ from cbase.allocator_protocol.c_allocator_protocol cimport AllocatorConfigContext, allocator_protocol
4
+ from cbase.allocator_protocol.c_heap_allocator cimport heap_allocator
5
+ from cbase.allocator_protocol.c_shm_comp cimport shm_allocator_ctx
6
+
7
+
8
+ cdef extern from "event_engine/base/c_allocator_protocol.h":
9
+ const c_bool EE_LOCAL_ONLY
10
+
11
+
12
+ cdef c_bool EE_CFG_LOCKED
13
+ cdef c_bool EE_CFG_SHARED
14
+ cdef c_bool EE_CFG_FREELIST
15
+
16
+
17
+ cdef class EEConfigContext(AllocatorConfigContext):
18
+ pass
19
+
20
+
21
+ cdef heap_allocator* EE_HEAP_ALLOCATOR_RAW
22
+ cdef shm_allocator_ctx* EE_SHM_ALLOCATOR_RAW
23
+
24
+ cdef allocator_protocol* EE_DEFAULT_ALLOCATOR
25
+ cdef allocator_protocol* EE_SHM_ALLOCATOR
26
+ cdef allocator_protocol* EE_HEAP_ALLOCATOR
27
+
28
+ cdef EEConfigContext EE_SHARED
29
+ cdef EEConfigContext EE_LOCKED
30
+ cdef EEConfigContext EE_LOCKFREE
31
+ cdef EEConfigContext EE_FREELIST
@@ -0,0 +1,99 @@
1
+ from libc.stdlib cimport calloc
2
+
3
+ from cbase.allocator_protocol.c_heap_allocator cimport c_heap_allocator_new
4
+ from cbase.allocator_protocol.c_shm_comp cimport c_shm_allocator_new, AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE
5
+
6
+
7
+ cdef c_bool EE_CFG_LOCKED = False
8
+ cdef c_bool EE_CFG_SHARED = False
9
+ cdef c_bool EE_CFG_FREELIST = True
10
+
11
+
12
+ cdef class EEConfigContext(AllocatorConfigContext):
13
+ cdef void c_bind(self, allocator_protocol* schematic=NULL):
14
+ self.allocator_schematic = schematic if schematic else EE_DEFAULT_ALLOCATOR
15
+
16
+ cdef void c_activate(self):
17
+ if 'locked' in self.overrides:
18
+ global EE_CFG_LOCKED
19
+ EE_CFG_LOCKED = self.overrides['locked']
20
+
21
+ if 'shared' in self.overrides:
22
+ global EE_CFG_SHARED
23
+ EE_CFG_SHARED = self.overrides['shared']
24
+
25
+ if 'freelist' in self.overrides:
26
+ global EE_CFG_FREELIST
27
+ EE_CFG_FREELIST = self.overrides['freelist']
28
+
29
+ AllocatorConfigContext.c_activate(self)
30
+
31
+ cdef void c_deactivate(self):
32
+ if 'locked' in self.originals:
33
+ global EE_CFG_LOCKED
34
+ EE_CFG_LOCKED = self.originals.get('locked')
35
+
36
+ if 'shared' in self.originals:
37
+ global EE_CFG_SHARED
38
+ EE_CFG_SHARED = self.originals.get('shared')
39
+
40
+ if 'freelist' in self.originals:
41
+ global EE_CFG_FREELIST
42
+ EE_CFG_FREELIST = self.originals.get('freelist')
43
+
44
+ AllocatorConfigContext.c_deactivate(self)
45
+
46
+
47
+ # --- Module-level allocator singletons ---
48
+
49
+ cdef heap_allocator* EE_HEAP_ALLOCATOR_RAW = c_heap_allocator_new()
50
+ if not EE_HEAP_ALLOCATOR_RAW:
51
+ raise OSError("Initialize EE heap allocator failed")
52
+
53
+ cdef shm_allocator_ctx* EE_SHM_ALLOCATOR_RAW = NULL
54
+
55
+ if not EE_LOCAL_ONLY:
56
+ EE_SHM_ALLOCATOR_RAW = c_shm_allocator_new(AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE, <char*> b"c_ee_shm")
57
+ if not EE_SHM_ALLOCATOR_RAW:
58
+ raise OSError("Initialize EE SHM allocator failed (prefix='c_ee_shm')")
59
+
60
+
61
+ cdef allocator_protocol* EE_DEFAULT_ALLOCATOR = <allocator_protocol*> calloc(1, sizeof(allocator_protocol))
62
+ cdef allocator_protocol* EE_HEAP_ALLOCATOR = <allocator_protocol*> calloc(1, sizeof(allocator_protocol))
63
+
64
+ EE_DEFAULT_ALLOCATOR.with_lock = EE_CFG_LOCKED
65
+ EE_DEFAULT_ALLOCATOR.with_shm = EE_CFG_SHARED
66
+ EE_DEFAULT_ALLOCATOR.with_freelist = EE_CFG_FREELIST
67
+ EE_DEFAULT_ALLOCATOR.shm_allocator_ctx = EE_SHM_ALLOCATOR_RAW
68
+ EE_DEFAULT_ALLOCATOR.shm_allocator = EE_SHM_ALLOCATOR_RAW.shm_allocator if EE_SHM_ALLOCATOR_RAW != NULL else NULL
69
+ EE_DEFAULT_ALLOCATOR.heap_allocator = EE_HEAP_ALLOCATOR_RAW
70
+
71
+ EE_HEAP_ALLOCATOR.with_lock = True
72
+ EE_HEAP_ALLOCATOR.with_shm = False
73
+ EE_HEAP_ALLOCATOR.with_freelist = True
74
+ EE_HEAP_ALLOCATOR.shm_allocator_ctx = NULL
75
+ EE_HEAP_ALLOCATOR.shm_allocator = NULL
76
+ EE_HEAP_ALLOCATOR.heap_allocator = EE_HEAP_ALLOCATOR_RAW
77
+
78
+ cdef allocator_protocol* EE_SHM_ALLOCATOR = NULL
79
+
80
+ if not EE_LOCAL_ONLY:
81
+ EE_SHM_ALLOCATOR = <allocator_protocol*> calloc(1, sizeof(allocator_protocol))
82
+
83
+ EE_SHM_ALLOCATOR.with_lock = True
84
+ EE_SHM_ALLOCATOR.with_shm = True
85
+ EE_SHM_ALLOCATOR.with_freelist = True
86
+ EE_SHM_ALLOCATOR.shm_allocator_ctx = EE_SHM_ALLOCATOR_RAW
87
+ EE_SHM_ALLOCATOR.shm_allocator = EE_SHM_ALLOCATOR_RAW.shm_allocator
88
+ EE_SHM_ALLOCATOR.heap_allocator = NULL
89
+
90
+
91
+ cdef EEConfigContext EE_SHARED = EEConfigContext(shared=True)
92
+ cdef EEConfigContext EE_LOCKED = EEConfigContext(locked=True)
93
+ cdef EEConfigContext EE_LOCKFREE = EEConfigContext(locked=False)
94
+ cdef EEConfigContext EE_FREELIST = EEConfigContext(freelist=True)
95
+
96
+ globals()['EE_SHARED'] = EE_SHARED
97
+ globals()['EE_LOCKED'] = EE_LOCKED
98
+ globals()['EE_LOCKFREE'] = EE_LOCKFREE
99
+ globals()['EE_FREELIST'] = EE_FREELIST
@@ -0,0 +1,189 @@
1
+ from .c_topic cimport (
2
+ DEFAULT_TOPIC_SEP,
3
+ DEFAULT_OPTION_SEP,
4
+ DEFAULT_RANGE_BRACKETS,
5
+ DEFAULT_WILDCARD_BRACKETS,
6
+ DEFAULT_WILDCARD_MARKER,
7
+ DEFAULT_PATTERN_DELIM,
8
+ GLOBAL_INTERNAL_MAP,
9
+
10
+ c_get_global_internal_map,
11
+ c_topic_new,
12
+ c_topic_free,
13
+ c_topic_internalize,
14
+ c_topic_append,
15
+ c_topic_parse,
16
+ c_topic_assign,
17
+ c_topic_update_literal,
18
+ c_topic_match,
19
+ c_topic_match_new,
20
+ c_topic_match_free,
21
+ c_topic_match_bool,
22
+
23
+ evt_topic_type, evt_topic_part,
24
+ TopicPartExact, evt_topic_exact,
25
+ TopicPartAny, evt_topic_any,
26
+ TopicPartRange, evt_topic_range,
27
+ TopicPartPattern, evt_topic_pattern,
28
+ TopicPart, evt_topic_part_variant,
29
+ TopicMatchResult, evt_topic_match,
30
+ Topic, evt_topic,
31
+
32
+ TOPIC_ALLOCATOR,
33
+ get_internal_topic,
34
+ get_internal_map,
35
+ )
36
+
37
+ from .c_event cimport (
38
+ evt_py_payload, evt_message_payload, MessagePayload,
39
+ c_evt_payload_new,
40
+ c_evt_payload_free,
41
+
42
+ evt_callback_bare,
43
+ evt_callback_with_args,
44
+ evt_callback_with_topic,
45
+ evt_callback_with_userdata,
46
+ evt_callback_with_args_topic,
47
+ evt_callback_with_args_userdata,
48
+ evt_callback_with_topic_userdata,
49
+ evt_callback_with_args_topic_userdata,
50
+ evt_callback_with_payload,
51
+ evt_callback_with_payload_userdata,
52
+
53
+ evt_callback_type,
54
+ evt_callback_variants,
55
+ evt_callback,
56
+ evt_py_callable,
57
+
58
+ evt_hook_watcher_type,
59
+ evt_hook_watcher_fn,
60
+ evt_hook_watcher,
61
+ evt_hook_stats, c_hook_enter, c_hook_exit,
62
+
63
+ evt_hook, EventHook, EventHookEx,
64
+
65
+ c_evt_callback_invoke,
66
+ c_evt_hook_new,
67
+ c_evt_hook_free,
68
+ c_evt_hook_add_watcher,
69
+ c_evt_hook_register_callback,
70
+ c_evt_hook_pop_callback,
71
+ c_evt_hook_invoke,
72
+ evt_hook_ret_code,
73
+
74
+ EMPTY_ARGS, TOPIC_FIELD_NAME
75
+ )
76
+
77
+ from .c_engine cimport (
78
+ DEFAULT_MQ_CAPACITY,
79
+ DEFAULT_MQ_SPIN_LIMIT,
80
+ DEFAULT_MQ_TIMEOUT_SECONDS,
81
+ message_queue,
82
+
83
+ c_mq_new,
84
+ c_mq_free,
85
+ c_mq_put,
86
+ c_mq_get,
87
+ c_mq_put_await,
88
+ c_mq_get_await,
89
+ c_mq_put_busy,
90
+ c_mq_get_busy,
91
+ c_mq_put_hybrid,
92
+ c_mq_get_hybrid,
93
+ c_mq_occupied,
94
+
95
+ EventEngine, EventEngineEx
96
+ )
97
+
98
+ __all__ = [
99
+ 'DEFAULT_TOPIC_SEP',
100
+ 'DEFAULT_OPTION_SEP',
101
+ 'DEFAULT_RANGE_BRACKETS',
102
+ 'DEFAULT_WILDCARD_BRACKETS',
103
+ 'DEFAULT_WILDCARD_MARKER',
104
+ 'DEFAULT_PATTERN_DELIM',
105
+ 'GLOBAL_INTERNAL_MAP',
106
+
107
+ 'c_get_global_internal_map',
108
+ 'c_topic_new',
109
+ 'c_topic_free',
110
+ 'c_topic_internalize',
111
+ 'c_topic_append',
112
+ 'c_topic_parse',
113
+ 'c_topic_assign',
114
+ 'c_topic_update_literal',
115
+ 'c_topic_match',
116
+ 'c_topic_match_new',
117
+ 'c_topic_match_free',
118
+ 'c_topic_match_bool',
119
+
120
+ 'evt_topic_type', 'evt_topic_part',
121
+ 'TopicPartExact', 'evt_topic_exact',
122
+ 'TopicPartAny', 'evt_topic_any',
123
+ 'TopicPartRange', 'evt_topic_range',
124
+ 'TopicPartPattern', 'evt_topic_pattern',
125
+ 'TopicPart', 'evt_topic_part_variant',
126
+ 'TopicMatchResult', 'evt_topic_match',
127
+ 'Topic', 'evt_topic',
128
+
129
+ 'TOPIC_ALLOCATOR',
130
+ 'get_internal_topic',
131
+ 'get_internal_map',
132
+
133
+ 'evt_py_payload', 'evt_message_payload', 'MessagePayload',
134
+ 'c_evt_payload_new',
135
+ 'c_evt_payload_free',
136
+
137
+ 'evt_callback_bare',
138
+ 'evt_callback_with_args',
139
+ 'evt_callback_with_topic',
140
+ 'evt_callback_with_userdata',
141
+ 'evt_callback_with_args_topic',
142
+ 'evt_callback_with_args_userdata',
143
+ 'evt_callback_with_topic_userdata',
144
+ 'evt_callback_with_args_topic_userdata',
145
+ 'evt_callback_with_payload',
146
+ 'evt_callback_with_payload_userdata',
147
+
148
+ 'evt_callback_type',
149
+ 'evt_callback_variants',
150
+ 'evt_callback',
151
+ 'evt_py_callable',
152
+
153
+ 'evt_hook_watcher_type',
154
+ 'evt_hook_watcher_fn',
155
+ 'evt_hook_watcher',
156
+ 'evt_hook_stats', 'c_hook_enter', 'c_hook_exit',
157
+
158
+ 'evt_hook', 'EventHook', 'EventHookEx',
159
+
160
+ 'c_evt_callback_invoke',
161
+ 'c_evt_hook_new',
162
+ 'c_evt_hook_free',
163
+ 'c_evt_hook_add_watcher',
164
+ 'c_evt_hook_register_callback',
165
+ 'c_evt_hook_pop_callback',
166
+ 'c_evt_hook_invoke',
167
+ 'evt_hook_ret_code',
168
+
169
+ 'EMPTY_ARGS', 'TOPIC_FIELD_NAME',
170
+
171
+ 'DEFAULT_MQ_CAPACITY',
172
+ 'DEFAULT_MQ_SPIN_LIMIT',
173
+ 'DEFAULT_MQ_TIMEOUT_SECONDS',
174
+ 'message_queue',
175
+
176
+ 'c_mq_new',
177
+ 'c_mq_free',
178
+ 'c_mq_put',
179
+ 'c_mq_get',
180
+ 'c_mq_put_await',
181
+ 'c_mq_get_await',
182
+ 'c_mq_put_busy',
183
+ 'c_mq_get_busy',
184
+ 'c_mq_put_hybrid',
185
+ 'c_mq_get_hybrid',
186
+ 'c_mq_occupied',
187
+
188
+ 'EventEngine', 'EventEngineEx'
189
+ ]
@@ -0,0 +1,189 @@
1
+ from .c_topic cimport (
2
+ DEFAULT_TOPIC_SEP,
3
+ DEFAULT_OPTION_SEP,
4
+ DEFAULT_RANGE_BRACKETS,
5
+ DEFAULT_WILDCARD_BRACKETS,
6
+ DEFAULT_WILDCARD_MARKER,
7
+ DEFAULT_PATTERN_DELIM,
8
+ GLOBAL_INTERNAL_MAP,
9
+
10
+ c_get_global_internal_map,
11
+ c_topic_new,
12
+ c_topic_free,
13
+ c_topic_internalize,
14
+ c_topic_append,
15
+ c_topic_parse,
16
+ c_topic_assign,
17
+ c_topic_update_literal,
18
+ c_topic_match,
19
+ c_topic_match_new,
20
+ c_topic_match_free,
21
+ c_topic_match_bool,
22
+
23
+ evt_topic_type, evt_topic_part,
24
+ TopicPartExact, evt_topic_exact,
25
+ TopicPartAny, evt_topic_any,
26
+ TopicPartRange, evt_topic_range,
27
+ TopicPartPattern, evt_topic_pattern,
28
+ TopicPart, evt_topic_part_variant,
29
+ TopicMatchResult, evt_topic_match,
30
+ Topic, evt_topic,
31
+
32
+ TOPIC_ALLOCATOR,
33
+ get_internal_topic,
34
+ get_internal_map,
35
+ )
36
+
37
+ from .c_event cimport (
38
+ evt_py_payload, evt_message_payload, MessagePayload,
39
+ c_evt_payload_new,
40
+ c_evt_payload_free,
41
+
42
+ evt_callback_bare,
43
+ evt_callback_with_args,
44
+ evt_callback_with_topic,
45
+ evt_callback_with_userdata,
46
+ evt_callback_with_args_topic,
47
+ evt_callback_with_args_userdata,
48
+ evt_callback_with_topic_userdata,
49
+ evt_callback_with_args_topic_userdata,
50
+ evt_callback_with_payload,
51
+ evt_callback_with_payload_userdata,
52
+
53
+ evt_callback_type,
54
+ evt_callback_variants,
55
+ evt_callback,
56
+ evt_py_callable,
57
+
58
+ evt_hook_watcher_type,
59
+ evt_hook_watcher_fn,
60
+ evt_hook_watcher,
61
+ evt_hook_stats, c_hook_enter, c_hook_exit,
62
+
63
+ evt_hook, EventHook, EventHookEx,
64
+
65
+ c_evt_callback_invoke,
66
+ c_evt_hook_new,
67
+ c_evt_hook_free,
68
+ c_evt_hook_add_watcher,
69
+ c_evt_hook_register_callback,
70
+ c_evt_hook_pop_callback,
71
+ c_evt_hook_invoke,
72
+ evt_hook_ret_code,
73
+
74
+ EMPTY_ARGS, TOPIC_FIELD_NAME
75
+ )
76
+
77
+ from .c_engine cimport (
78
+ DEFAULT_MQ_CAPACITY,
79
+ DEFAULT_MQ_SPIN_LIMIT,
80
+ DEFAULT_MQ_TIMEOUT_SECONDS,
81
+ message_queue,
82
+
83
+ c_mq_new,
84
+ c_mq_free,
85
+ c_mq_put,
86
+ c_mq_get,
87
+ c_mq_put_await,
88
+ c_mq_get_await,
89
+ c_mq_put_busy,
90
+ c_mq_get_busy,
91
+ c_mq_put_hybrid,
92
+ c_mq_get_hybrid,
93
+ c_mq_occupied,
94
+
95
+ EventEngine, EventEngineEx
96
+ )
97
+
98
+ __all__ = [
99
+ 'DEFAULT_TOPIC_SEP',
100
+ 'DEFAULT_OPTION_SEP',
101
+ 'DEFAULT_RANGE_BRACKETS',
102
+ 'DEFAULT_WILDCARD_BRACKETS',
103
+ 'DEFAULT_WILDCARD_MARKER',
104
+ 'DEFAULT_PATTERN_DELIM',
105
+ 'GLOBAL_INTERNAL_MAP',
106
+
107
+ 'c_get_global_internal_map',
108
+ 'c_topic_new',
109
+ 'c_topic_free',
110
+ 'c_topic_internalize',
111
+ 'c_topic_append',
112
+ 'c_topic_parse',
113
+ 'c_topic_assign',
114
+ 'c_topic_update_literal',
115
+ 'c_topic_match',
116
+ 'c_topic_match_new',
117
+ 'c_topic_match_free',
118
+ 'c_topic_match_bool',
119
+
120
+ 'evt_topic_type', 'evt_topic_part',
121
+ 'TopicPartExact', 'evt_topic_exact',
122
+ 'TopicPartAny', 'evt_topic_any',
123
+ 'TopicPartRange', 'evt_topic_range',
124
+ 'TopicPartPattern', 'evt_topic_pattern',
125
+ 'TopicPart', 'evt_topic_part_variant',
126
+ 'TopicMatchResult', 'evt_topic_match',
127
+ 'Topic', 'evt_topic',
128
+
129
+ 'TOPIC_ALLOCATOR',
130
+ 'get_internal_topic',
131
+ 'get_internal_map',
132
+
133
+ 'evt_py_payload', 'evt_message_payload', 'MessagePayload',
134
+ 'c_evt_payload_new',
135
+ 'c_evt_payload_free',
136
+
137
+ 'evt_callback_bare',
138
+ 'evt_callback_with_args',
139
+ 'evt_callback_with_topic',
140
+ 'evt_callback_with_userdata',
141
+ 'evt_callback_with_args_topic',
142
+ 'evt_callback_with_args_userdata',
143
+ 'evt_callback_with_topic_userdata',
144
+ 'evt_callback_with_args_topic_userdata',
145
+ 'evt_callback_with_payload',
146
+ 'evt_callback_with_payload_userdata',
147
+
148
+ 'evt_callback_type',
149
+ 'evt_callback_variants',
150
+ 'evt_callback',
151
+ 'evt_py_callable',
152
+
153
+ 'evt_hook_watcher_type',
154
+ 'evt_hook_watcher_fn',
155
+ 'evt_hook_watcher',
156
+ 'evt_hook_stats', 'c_hook_enter', 'c_hook_exit',
157
+
158
+ 'evt_hook', 'EventHook', 'EventHookEx',
159
+
160
+ 'c_evt_callback_invoke',
161
+ 'c_evt_hook_new',
162
+ 'c_evt_hook_free',
163
+ 'c_evt_hook_add_watcher',
164
+ 'c_evt_hook_register_callback',
165
+ 'c_evt_hook_pop_callback',
166
+ 'c_evt_hook_invoke',
167
+ 'evt_hook_ret_code',
168
+
169
+ 'EMPTY_ARGS', 'TOPIC_FIELD_NAME',
170
+
171
+ 'DEFAULT_MQ_CAPACITY',
172
+ 'DEFAULT_MQ_SPIN_LIMIT',
173
+ 'DEFAULT_MQ_TIMEOUT_SECONDS',
174
+ 'message_queue',
175
+
176
+ 'c_mq_new',
177
+ 'c_mq_free',
178
+ 'c_mq_put',
179
+ 'c_mq_get',
180
+ 'c_mq_put_await',
181
+ 'c_mq_get_await',
182
+ 'c_mq_put_busy',
183
+ 'c_mq_get_busy',
184
+ 'c_mq_put_hybrid',
185
+ 'c_mq_get_hybrid',
186
+ 'c_mq_occupied',
187
+
188
+ 'EventEngine', 'EventEngineEx'
189
+ ]
@@ -0,0 +1,84 @@
1
+ import logging
2
+
3
+ LOGGER = None
4
+
5
+
6
+ from .c_topic import (
7
+ TopicType,
8
+ TopicPart, TopicPartExact, TopicPartAny, TopicPartRange, TopicPartPattern,
9
+ TopicMatchResult, Topic,
10
+ get_internal_topic, get_internal_map
11
+ )
12
+
13
+ from .c_event import MessagePayload, EventHook, EventHookEx
14
+
15
+ # Try to import the Cython implementation first, fall back to pure Python if unavailable
16
+ USING_FALLBACK = False
17
+
18
+ try:
19
+ assert not USING_FALLBACK
20
+ from .c_engine import Full, Empty, EventEngine, EventEngineEx
21
+
22
+ USING_FALLBACK = False
23
+ except (ImportError, AssertionError) as e:
24
+ # Cython module not available (e.g., on Windows or not compiled)
25
+ # Use the pure Python fallback implementation
26
+ import warnings
27
+
28
+ warnings.warn(
29
+ f"Cython c_engine module not available ({e}), using pure Python fallback implementation. "
30
+ "Performance may be reduced compared to the Cython version.",
31
+ ImportWarning,
32
+ stacklevel=2
33
+ )
34
+ from .fallback_engine import Full, Empty, EventEngine, EventEngineEx
35
+
36
+ USING_FALLBACK = True
37
+
38
+
39
+ def set_logger(logger: logging.Logger):
40
+ global LOGGER
41
+ from . import c_topic, c_event, c_engine
42
+ c_topic.LOGGER = logger
43
+ c_event.LOGGER = logger
44
+ c_engine.LOGGER = logger
45
+ LOGGER = logger
46
+
47
+ """Set the root EventEngine logger and propagate to submodules.
48
+
49
+ This updates event_engine.base.LOGGER and the module-level LOGGER used by
50
+ c_event/fallback_engine (if available) so subsequent logs use the provided logger.
51
+ """
52
+ import importlib
53
+ base_mod = importlib.import_module('event_engine.base')
54
+ base_mod.LOGGER = logger
55
+ # Try to update c_event module logger
56
+ try:
57
+ from . import c_event as _c_event
58
+ _c_event.LOGGER = logger.getChild('Event')
59
+ except Exception:
60
+ pass
61
+
62
+ # Try to update c_engine module logger
63
+ try:
64
+ from . import c_engine as _c_engine
65
+ _c_engine.LOGGER = logger.getChild('Engine')
66
+ except Exception:
67
+ pass
68
+
69
+ # If capi is using fallback engine internally, update its module logger as well
70
+ try:
71
+ from . import fallback_engine as _c_engine_fallback
72
+ _c_engine_fallback.LOGGER = logger.getChild('Engine')
73
+ except Exception:
74
+ pass
75
+
76
+
77
+ __all__ = [
78
+ 'TopicType', 'TopicPart', 'TopicPartExact', 'TopicPartAny', 'TopicPartRange', 'TopicPartPattern',
79
+ 'TopicMatchResult', 'Topic',
80
+ 'get_internal_topic', 'get_internal_map',
81
+ 'MessagePayload', 'EventHook', 'EventHookEx',
82
+ 'Full', 'Empty', 'EventEngine', 'EventEngineEx', 'USING_FALLBACK',
83
+ 'set_logger'
84
+ ]