com.wallstop-studios.dxmessaging 2.1.9 → 3.0.1

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 (249) hide show
  1. package/CHANGELOG.md +106 -65
  2. package/CHANGELOG.md.meta +7 -7
  3. package/Editor/Analyzers/BaseCallIlInspector.cs +277 -0
  4. package/Editor/Analyzers/BaseCallIlInspector.cs.meta +11 -0
  5. package/Editor/Analyzers/BaseCallLogMessageParser.cs +295 -0
  6. package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +11 -0
  7. package/Editor/Analyzers/BaseCallReportAggregator.cs +308 -0
  8. package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +11 -0
  9. package/Editor/Analyzers/BaseCallTypeScanner.cs +110 -0
  10. package/Editor/Analyzers/BaseCallTypeScanner.cs.meta +11 -0
  11. package/Editor/Analyzers/BaseCallTypeScannerCore.cs +562 -0
  12. package/Editor/Analyzers/BaseCallTypeScannerCore.cs.meta +11 -0
  13. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +1122 -0
  14. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +11 -0
  15. package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +44 -44
  16. package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +44 -44
  17. package/Editor/Analyzers/System.Collections.Immutable.dll.meta +44 -44
  18. package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +44 -44
  19. package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +44 -44
  20. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
  21. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +33 -0
  22. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
  23. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +72 -72
  24. package/Editor/Analyzers.meta +8 -8
  25. package/Editor/AssemblyInfo.cs.meta +3 -3
  26. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +81 -0
  27. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +11 -0
  28. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +420 -0
  29. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +11 -0
  30. package/Editor/CustomEditors/MessagingComponentEditor.cs +1 -1
  31. package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +2 -2
  32. package/Editor/CustomEditors.meta +2 -2
  33. package/Editor/DxMessagingEditorInitializer.cs +1 -1
  34. package/Editor/DxMessagingEditorInitializer.cs.meta +2 -2
  35. package/Editor/DxMessagingMenu.cs.meta +11 -11
  36. package/Editor/DxMessagingSceneBuildProcessor.cs.meta +11 -11
  37. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +190 -0
  38. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +11 -0
  39. package/Editor/Settings/DxMessagingSettings.cs +189 -0
  40. package/Editor/Settings/DxMessagingSettings.cs.meta +2 -2
  41. package/Editor/Settings/DxMessagingSettingsProvider.cs +50 -33
  42. package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +2 -2
  43. package/Editor/Settings.meta +2 -2
  44. package/Editor/SetupCscRsp.cs +209 -8
  45. package/Editor/SetupCscRsp.cs.meta +2 -2
  46. package/Editor/Testing/MessagingComponentEditorHarness.cs +1 -1
  47. package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +3 -3
  48. package/Editor/Testing.meta +3 -3
  49. package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +14 -14
  50. package/Editor/WallstopStudios.DxMessaging.Editor.asmdef.meta +7 -7
  51. package/Editor.meta +8 -8
  52. package/LICENSE.md +9 -9
  53. package/LICENSE.md.meta +7 -7
  54. package/README.md +941 -900
  55. package/README.md.meta +7 -7
  56. package/Runtime/AssemblyInfo.cs +4 -0
  57. package/Runtime/AssemblyInfo.cs.meta +2 -2
  58. package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +2 -2
  59. package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +2 -2
  60. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs +26 -0
  61. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +11 -0
  62. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +2 -2
  63. package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +2 -2
  64. package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +2 -2
  65. package/Runtime/Core/Attributes.meta +2 -2
  66. package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs +195 -0
  67. package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs.meta +11 -0
  68. package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs +179 -0
  69. package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs.meta +11 -0
  70. package/Runtime/Core/Configuration.meta +9 -0
  71. package/Runtime/Core/DataStructure/CyclicBuffer.cs +2 -2
  72. package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +2 -2
  73. package/Runtime/Core/DataStructure.meta +2 -2
  74. package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +2 -2
  75. package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +2 -2
  76. package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +2 -2
  77. package/Runtime/Core/Diagnostics.meta +2 -2
  78. package/Runtime/Core/DxMessagingStaticState.cs +19 -0
  79. package/Runtime/Core/DxMessagingStaticState.cs.meta +11 -11
  80. package/Runtime/Core/Extensions/EnumExtensions.cs.meta +2 -2
  81. package/Runtime/Core/Extensions/IListExtensions.cs.meta +2 -2
  82. package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -12
  83. package/Runtime/Core/Extensions/MessageExtensions.cs.meta +11 -11
  84. package/Runtime/Core/Extensions.meta +8 -8
  85. package/Runtime/Core/Helper/MessageCache.cs +32 -0
  86. package/Runtime/Core/Helper/MessageCache.cs.meta +2 -2
  87. package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +2 -2
  88. package/Runtime/Core/Helper.meta +2 -2
  89. package/Runtime/Core/IMessage.cs +3 -3
  90. package/Runtime/Core/IMessage.cs.meta +11 -11
  91. package/Runtime/Core/InstanceId.cs.meta +11 -11
  92. package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs +51 -0
  93. package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs.meta +11 -0
  94. package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs +38 -0
  95. package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs.meta +11 -0
  96. package/Runtime/Core/Internal/TypedSlotIndex.cs +81 -0
  97. package/Runtime/Core/Internal/TypedSlotIndex.cs.meta +11 -0
  98. package/Runtime/Core/Internal/TypedSlots.cs +613 -0
  99. package/Runtime/Core/Internal/TypedSlots.cs.meta +11 -0
  100. package/Runtime/Core/Internal.meta +9 -0
  101. package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +11 -11
  102. package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -11
  103. package/Runtime/Core/MessageBus/IMessageBus.cs +177 -3
  104. package/Runtime/Core/MessageBus/IMessageBus.cs.meta +11 -11
  105. package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -11
  106. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -11
  107. package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs +16 -0
  108. package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs.meta +11 -0
  109. package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs +40 -0
  110. package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs.meta +11 -0
  111. package/Runtime/Core/MessageBus/Internal/BusSlots.cs +718 -0
  112. package/Runtime/Core/MessageBus/Internal/BusSlots.cs.meta +11 -0
  113. package/Runtime/Core/MessageBus/Internal/DispatchKind.cs +38 -0
  114. package/Runtime/Core/MessageBus/Internal/DispatchKind.cs.meta +11 -0
  115. package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs +20 -0
  116. package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs.meta +11 -0
  117. package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs +28 -0
  118. package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs.meta +11 -0
  119. package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs +48 -0
  120. package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs.meta +11 -0
  121. package/Runtime/Core/MessageBus/Internal/ISweepable.cs +15 -0
  122. package/Runtime/Core/MessageBus/Internal/ISweepable.cs.meta +11 -0
  123. package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs +222 -0
  124. package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs.meta +11 -0
  125. package/Runtime/Core/MessageBus/Internal/SlotKey.cs +192 -0
  126. package/Runtime/Core/MessageBus/Internal/SlotKey.cs.meta +11 -0
  127. package/Runtime/Core/MessageBus/Internal.meta +9 -0
  128. package/Runtime/Core/MessageBus/MessageBus.cs +2651 -500
  129. package/Runtime/Core/MessageBus/MessageBus.cs.meta +11 -11
  130. package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -11
  131. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -11
  132. package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +11 -11
  133. package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +11 -11
  134. package/Runtime/Core/MessageBus.meta +8 -8
  135. package/Runtime/Core/MessageHandler.cs +2019 -542
  136. package/Runtime/Core/MessageHandler.cs.meta +11 -11
  137. package/Runtime/Core/MessageRegistrationHandle.cs.meta +11 -11
  138. package/Runtime/Core/MessageRegistrationToken.cs +7 -0
  139. package/Runtime/Core/MessageRegistrationToken.cs.meta +11 -11
  140. package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +2 -2
  141. package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +11 -11
  142. package/Runtime/Core/Messages/ITargetedMessage.cs.meta +11 -11
  143. package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +11 -11
  144. package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +2 -2
  145. package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +11 -11
  146. package/Runtime/Core/Messages/StringMessage.cs.meta +2 -2
  147. package/Runtime/Core/Messages.meta +8 -8
  148. package/Runtime/Core/MessagingDebug.cs.meta +11 -11
  149. package/Runtime/Core/Pooling/CollectionPool.cs +266 -0
  150. package/Runtime/Core/Pooling/CollectionPool.cs.meta +11 -0
  151. package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs +30 -0
  152. package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs.meta +11 -0
  153. package/Runtime/Core/Pooling/DxPools.cs +157 -0
  154. package/Runtime/Core/Pooling/DxPools.cs.meta +11 -0
  155. package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs +106 -0
  156. package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs.meta +11 -0
  157. package/Runtime/Core/Pooling/IDxMessagingClock.cs +18 -0
  158. package/Runtime/Core/Pooling/IDxMessagingClock.cs.meta +11 -0
  159. package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs +55 -0
  160. package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs.meta +11 -0
  161. package/Runtime/Core/Pooling/StopwatchClock.cs +27 -0
  162. package/Runtime/Core/Pooling/StopwatchClock.cs.meta +11 -0
  163. package/Runtime/Core/Pooling/UnityRealtimeClock.cs +31 -0
  164. package/Runtime/Core/Pooling/UnityRealtimeClock.cs.meta +11 -0
  165. package/Runtime/Core/Pooling.meta +9 -0
  166. package/Runtime/Core.meta +8 -8
  167. package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -12
  168. package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +11 -11
  169. package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -12
  170. package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +2 -2
  171. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
  172. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -11
  173. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -20
  174. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -7
  175. package/Runtime/Unity/Integrations/Reflex.meta +8 -8
  176. package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +2 -2
  177. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +109 -1
  178. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -11
  179. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -30
  180. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -7
  181. package/Runtime/Unity/Integrations/VContainer.meta +8 -8
  182. package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +2 -2
  183. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -30
  184. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -7
  185. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +79 -1
  186. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -11
  187. package/Runtime/Unity/Integrations/Zenject.meta +8 -8
  188. package/Runtime/Unity/Integrations.meta +8 -8
  189. package/Runtime/Unity/MessageAwareComponent.cs +29 -0
  190. package/Runtime/Unity/MessageAwareComponent.cs.meta +11 -11
  191. package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -12
  192. package/Runtime/Unity/MessagingComponent.cs.meta +11 -11
  193. package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -12
  194. package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -12
  195. package/Runtime/Unity.meta +8 -8
  196. package/Runtime/WallstopStudios.DxMessaging.asmdef +14 -14
  197. package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
  198. package/Runtime.meta +8 -8
  199. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -98
  200. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -7
  201. package/Samples~/DI/Prefabs.meta +8 -8
  202. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -14
  203. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -8
  204. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -14
  205. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -8
  206. package/Samples~/DI/Providers.meta +8 -8
  207. package/Samples~/DI/README.md +51 -51
  208. package/Samples~/DI/README.md.meta +7 -7
  209. package/Samples~/DI/Reflex/SampleInstaller.cs +7 -0
  210. package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -11
  211. package/Samples~/DI/Reflex.meta +8 -8
  212. package/Samples~/DI/VContainer/SampleLifetimeScope.cs +6 -1
  213. package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -11
  214. package/Samples~/DI/VContainer.meta +8 -8
  215. package/Samples~/DI/Zenject/SampleInstaller.cs +8 -0
  216. package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -11
  217. package/Samples~/DI/Zenject.meta +8 -8
  218. package/Samples~/DI.meta +8 -8
  219. package/Samples~/Mini Combat/Boot.cs.meta +11 -11
  220. package/Samples~/Mini Combat/Enemy.cs.meta +11 -11
  221. package/Samples~/Mini Combat/Messages.cs.meta +11 -11
  222. package/Samples~/Mini Combat/Player.cs.meta +11 -11
  223. package/Samples~/Mini Combat/README.md +324 -323
  224. package/Samples~/Mini Combat/README.md.meta +7 -7
  225. package/Samples~/Mini Combat/UIOverlay.cs.meta +11 -11
  226. package/Samples~/Mini Combat/Walkthrough.md +430 -430
  227. package/Samples~/Mini Combat/Walkthrough.md.meta +7 -7
  228. package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef +13 -13
  229. package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef.meta +7 -7
  230. package/Samples~/Mini Combat.meta +8 -8
  231. package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +11 -11
  232. package/Samples~/UI Buttons + Inspector/Messages.cs.meta +11 -11
  233. package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +11 -11
  234. package/Samples~/UI Buttons + Inspector/README.md +210 -209
  235. package/Samples~/UI Buttons + Inspector/README.md.meta +7 -7
  236. package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +11 -11
  237. package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef +13 -13
  238. package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef.meta +7 -7
  239. package/Samples~/UI Buttons + Inspector.meta +8 -8
  240. package/SourceGenerators/Directory.Build.props.meta +7 -7
  241. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +11 -11
  242. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +2 -2
  243. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj.meta +7 -7
  244. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.meta +8 -8
  245. package/SourceGenerators.meta +8 -8
  246. package/Third Party Notices.md +3 -3
  247. package/Third Party Notices.md.meta +7 -7
  248. package/package.json +115 -92
  249. package/package.json.meta +7 -7
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 45218d07f193b154a9aa56435fcbb83d
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 45218d07f193b154a9aa56435fcbb83d
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -22,10 +22,17 @@ namespace DxMessaging.Core.MessageBus
22
22
  /// </list>
23
23
  /// <para>Message categories:</para>
24
24
  /// <list type="bullet">
25
- /// <item><description><see cref="Messages.IUntargetedMessage"/> Global notifications.</description></item>
26
- /// <item><description><see cref="Messages.ITargetedMessage"/> Directed at a specific <see cref="InstanceId"/>.</description></item>
27
- /// <item><description><see cref="Messages.IBroadcastMessage"/> Emitted from a source for any listener.</description></item>
25
+ /// <item><description><see cref="Messages.IUntargetedMessage"/> -- Global notifications.</description></item>
26
+ /// <item><description><see cref="Messages.ITargetedMessage"/> -- Directed at a specific <see cref="InstanceId"/>.</description></item>
27
+ /// <item><description><see cref="Messages.IBroadcastMessage"/> -- Emitted from a source for any listener.</description></item>
28
28
  /// </list>
29
+ /// <para>
30
+ /// Contract note: emitting any message on a bus with no registered handlers must
31
+ /// be a silent no-op. Implementations must NOT throw, log, or otherwise surface
32
+ /// the empty-bus state to the caller. The
33
+ /// <c>LifecycleEdgeCasesTests.EmitOnEmptyBusIsSilentNoOp</c> test pins this
34
+ /// contract for every message kind.
35
+ /// </para>
29
36
  /// </remarks>
30
37
  /// <example>
31
38
  /// <code>
@@ -56,6 +63,21 @@ namespace DxMessaging.Core.MessageBus
56
63
 
57
64
  long EmissionId { get; }
58
65
 
66
+ /// <summary>
67
+ /// Reclaim empty message slots and pooled collections owned by this bus.
68
+ /// </summary>
69
+ /// <remarks>
70
+ /// Non-Unity and headless hosts must call this periodically when they need
71
+ /// deterministic reclamation. The automatic PlayerLoop sweep hook is only
72
+ /// installed on Unity 2021.3 or newer player/editor hosts.
73
+ /// </remarks>
74
+ /// <param name="force">
75
+ /// When true, ignores idle-age thresholds and drains shared pools to zero.
76
+ /// When false, only slots past the configured idle threshold are eligible.
77
+ /// </param>
78
+ /// <returns>Counts describing what was reclaimed.</returns>
79
+ TrimResult Trim(bool force = false);
80
+
59
81
  /// <summary>
60
82
  /// Default buffer size for message emission history.
61
83
  /// </summary>
@@ -112,12 +134,129 @@ namespace DxMessaging.Core.MessageBus
112
134
  bool DiagnosticsMode { get; }
113
135
 
114
136
  int RegisteredGlobalSequentialIndex { get; }
137
+
138
+ /// <summary>
139
+ /// Number of currently occupied per-message-type slots on this bus.
140
+ /// </summary>
141
+ int OccupiedTypeSlots { get; }
142
+
143
+ /// <summary>
144
+ /// Number of currently occupied per-context target/source slots on this bus.
145
+ /// </summary>
146
+ int OccupiedTargetSlots { get; }
147
+
148
+ /// <summary>
149
+ /// Result returned by <see cref="Trim"/>.
150
+ /// </summary>
151
+ readonly struct TrimResult : IEquatable<TrimResult>
152
+ {
153
+ public TrimResult(
154
+ int typeSlotsEvicted,
155
+ int targetSlotsEvicted,
156
+ int pooledCollectionsEvicted,
157
+ int liveTypeSlotsRemaining
158
+ )
159
+ {
160
+ TypeSlotsEvicted = typeSlotsEvicted;
161
+ TargetSlotsEvicted = targetSlotsEvicted;
162
+ PooledCollectionsEvicted = pooledCollectionsEvicted;
163
+ LiveTypeSlotsRemaining = liveTypeSlotsRemaining;
164
+ }
165
+
166
+ /// <summary>Number of typed-handler slots reset.</summary>
167
+ public int TypeSlotsEvicted { get; }
168
+
169
+ /// <summary>Number of bus target/source context entries removed.</summary>
170
+ public int TargetSlotsEvicted { get; }
171
+
172
+ /// <summary>Number of pooled collections dropped from shared pools.</summary>
173
+ public int PooledCollectionsEvicted { get; }
174
+
175
+ /// <summary>Number of occupied type slots remaining after trim.</summary>
176
+ public int LiveTypeSlotsRemaining { get; }
177
+
178
+ public bool Equals(TrimResult other) =>
179
+ TypeSlotsEvicted == other.TypeSlotsEvicted
180
+ && TargetSlotsEvicted == other.TargetSlotsEvicted
181
+ && PooledCollectionsEvicted == other.PooledCollectionsEvicted
182
+ && LiveTypeSlotsRemaining == other.LiveTypeSlotsRemaining;
183
+
184
+ public override bool Equals(object obj) => obj is TrimResult other && Equals(other);
185
+
186
+ public override int GetHashCode() =>
187
+ (
188
+ TypeSlotsEvicted,
189
+ TargetSlotsEvicted,
190
+ PooledCollectionsEvicted,
191
+ LiveTypeSlotsRemaining
192
+ ).GetHashCode();
193
+
194
+ public static bool operator ==(TrimResult left, TrimResult right) => left.Equals(right);
195
+
196
+ public static bool operator !=(TrimResult left, TrimResult right) =>
197
+ !left.Equals(right);
198
+
199
+ public override string ToString() =>
200
+ $"TrimResult(TypeSlotsEvicted={TypeSlotsEvicted}, TargetSlotsEvicted={TargetSlotsEvicted}, PooledCollectionsEvicted={PooledCollectionsEvicted}, LiveTypeSlotsRemaining={LiveTypeSlotsRemaining})";
201
+ }
202
+
115
203
  int RegisteredBroadcast { get; }
116
204
 
117
205
  int RegisteredTargeted { get; }
118
206
 
119
207
  int RegisteredUntargeted { get; }
120
208
 
209
+ /// <summary>
210
+ /// Total number of registered interceptors across all message kinds.
211
+ /// </summary>
212
+ /// <remarks>
213
+ /// <para>
214
+ /// Counts the unique <c>(interceptor delegate, priority)</c> pairs registered via
215
+ /// <see cref="RegisterUntargetedInterceptor{T}"/>, <see cref="RegisterTargetedInterceptor{T}"/>,
216
+ /// and <see cref="RegisterBroadcastInterceptor{T}"/>. Test infrastructure such as
217
+ /// <c>LeakWatcher</c> reads this counter to detect interceptor handles that escape
218
+ /// a watched region. Single-thread contract: read on the same thread that drives dispatch.
219
+ /// </para>
220
+ /// <para>
221
+ /// Aggregated by walking the per-kind interceptor caches; the call is O(n) in the
222
+ /// number of message types known to the bus. Snapshot at the start of a tracked
223
+ /// region rather than reading in a hot loop.
224
+ /// </para>
225
+ /// </remarks>
226
+ int RegisteredInterceptors { get; }
227
+
228
+ /// <summary>
229
+ /// Total number of registered post-processors across all message kinds.
230
+ /// </summary>
231
+ /// <remarks>
232
+ /// <para>
233
+ /// Sums per-message-type post-processor handler counts across the untargeted,
234
+ /// targeted, targeted-without-targeting, broadcast, and broadcast-without-source
235
+ /// post-processor sinks. Test infrastructure such as <c>LeakWatcher</c> reads this
236
+ /// counter to detect post-processor handles that escape a watched region. Same
237
+ /// single-thread contract as the other counters.
238
+ /// </para>
239
+ /// <para>
240
+ /// Aggregated on each read; prefer snapshotting at region boundaries instead of
241
+ /// polling every frame.
242
+ /// </para>
243
+ /// </remarks>
244
+ int RegisteredPostProcessors { get; }
245
+
246
+ /// <summary>
247
+ /// Number of registered global accept-all handlers on this bus.
248
+ /// </summary>
249
+ /// <remarks>
250
+ /// <para>
251
+ /// Counts the distinct <see cref="MessageHandler"/> instances registered via
252
+ /// <see cref="RegisterGlobalAcceptAll"/>. Test infrastructure such as
253
+ /// <c>LeakWatcher</c> reads this counter to detect global accept-all handles
254
+ /// that escape a watched region. Same single-thread contract as the other
255
+ /// counters.
256
+ /// </para>
257
+ /// </remarks>
258
+ int RegisteredGlobalAcceptAll { get; }
259
+
121
260
  /// <summary>
122
261
  /// Interceptor delegate for untargeted messages to transform or cancel them.
123
262
  /// </summary>
@@ -170,6 +309,16 @@ namespace DxMessaging.Core.MessageBus
170
309
  /// <param name="messageHandler">MessageHandler to register the TargetedMessages of the specified type.</param>
171
310
  /// <param name="priority">Priority at which to run; lower runs earlier.</param>
172
311
  /// <returns>The deregistration action. Invoke when the handler no longer wants to receive the messages.</returns>
312
+ /// <remarks>
313
+ /// To preserve frozen dispatch snapshots during in-flight emissions, the per-MessageHandler
314
+ /// typed-cache for <c>(target, priority)</c> is NOT removed when the last registration at
315
+ /// that pair is deregistered. Empty entries persist for the lifetime of the owning
316
+ /// MessageHandler. For typical Unity usage with a small fixed set of priorities and a
317
+ /// bounded set of long-lived target ids the residual footprint is trivial; code that
318
+ /// registers per-ephemeral-target (e.g. a global service that listens to messages targeted
319
+ /// at every spawned GameObject) should prefer <see cref="RegisterTargetedWithoutTargeting{T}"/>
320
+ /// or recycle MessageHandlers to avoid unbounded inner-dictionary growth.
321
+ /// </remarks>
173
322
  Action RegisterTargeted<T>(
174
323
  InstanceId target,
175
324
  MessageHandler messageHandler,
@@ -196,6 +345,16 @@ namespace DxMessaging.Core.MessageBus
196
345
  /// <param name="messageHandler">MessageHandler to register to accept BroadcastMessages.</param>
197
346
  /// <param name="priority"></param>
198
347
  /// <returns>The deregistration action. Should be invoked when the handler no longer wants to receive messages.</returns>
348
+ /// <remarks>
349
+ /// To preserve frozen dispatch snapshots during in-flight emissions, the per-MessageHandler
350
+ /// typed-cache for <c>(source, priority)</c> is NOT removed when the last registration at
351
+ /// that pair is deregistered. Empty entries persist for the lifetime of the owning
352
+ /// MessageHandler. For typical Unity usage with a small fixed set of priorities and a
353
+ /// bounded set of long-lived source ids the residual footprint is trivial; code that
354
+ /// registers per-ephemeral-source (e.g. a global service that listens to broadcasts from
355
+ /// every spawned GameObject) should prefer <see cref="RegisterSourcedBroadcastWithoutSource{T}"/>
356
+ /// or recycle MessageHandlers to avoid unbounded inner-dictionary growth.
357
+ /// </remarks>
199
358
  Action RegisterSourcedBroadcast<T>(
200
359
  InstanceId source,
201
360
  MessageHandler messageHandler,
@@ -243,6 +402,11 @@ namespace DxMessaging.Core.MessageBus
243
402
  /// param1: Current message instance by reference
244
403
  /// And returns: true if message handling should continue, false if message handling should be stopped.
245
404
  /// </note>
405
+ /// <remarks>
406
+ /// Interceptor delegates registered with this method are retained for the bus lifetime.
407
+ /// Calling the returned deregistration action removes the interceptor from dispatch, but
408
+ /// the delegate reference may remain until the final deregistration of that interceptor.
409
+ /// </remarks>
246
410
  /// <returns>The deregistration action. Should be invoked when the handler no longer wants to intercept messages.</returns>
247
411
  Action RegisterUntargetedInterceptor<T>(
248
412
  UntargetedInterceptor<T> interceptor,
@@ -268,6 +432,11 @@ namespace DxMessaging.Core.MessageBus
268
432
  /// param1: Current message instance by reference
269
433
  /// And returns: true if message handling should continue, false if message handling should be stopped.
270
434
  /// </note>
435
+ /// <remarks>
436
+ /// Interceptor delegates registered with this method are retained for the bus lifetime.
437
+ /// Calling the returned deregistration action removes the interceptor from dispatch, but
438
+ /// the delegate reference may remain until the final deregistration of that interceptor.
439
+ /// </remarks>
271
440
  /// <returns>The deregistration action. Should be invoked when the handler no longer wants to intercept messages.</returns>
272
441
  Action RegisterTargetedInterceptor<T>(TargetedInterceptor<T> interceptor, int priority = 0)
273
442
  where T : ITargetedMessage;
@@ -290,6 +459,11 @@ namespace DxMessaging.Core.MessageBus
290
459
  /// param1: Current message instance by reference
291
460
  /// And returns: true if message handling should continue, false if message handling should be stopped.
292
461
  /// </note>
462
+ /// <remarks>
463
+ /// Interceptor delegates registered with this method are retained for the bus lifetime.
464
+ /// Calling the returned deregistration action removes the interceptor from dispatch, but
465
+ /// the delegate reference may remain until the final deregistration of that interceptor.
466
+ /// </remarks>
293
467
  /// <returns>The deregistration action. Should be invoked when the handler no longer wants to intercept messages.</returns>
294
468
  Action RegisterBroadcastInterceptor<T>(
295
469
  BroadcastInterceptor<T> interceptor,
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 50c40ebd98e7cc64b86a02de6ad4cf78
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 50c40ebd98e7cc64b86a02de6ad4cf78
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 699419816064e4848a91186b632469d9
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 699419816064e4848a91186b632469d9
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: b7eed01fa2055aa49b8f89fff43a6892
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: b7eed01fa2055aa49b8f89fff43a6892
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,16 @@
1
+ namespace DxMessaging.Core.MessageBus.Internal
2
+ {
3
+ /// <summary>
4
+ /// Const-int positions into <c>MessageBus._contextSinks[]</c>. Every
5
+ /// position is populated; there are no reserved slots.
6
+ /// </summary>
7
+ internal static class BusContextIndex
8
+ {
9
+ public const int TargetedHandleDefault = 0;
10
+ public const int BroadcastHandleDefault = 1;
11
+ public const int TargetedPostProcessDefault = 2;
12
+ public const int BroadcastPostProcessDefault = 3;
13
+
14
+ public const int Length = 4;
15
+ }
16
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0cf95cdd0a324d99ab8acde42ea96193
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,40 @@
1
+ namespace DxMessaging.Core.MessageBus.Internal
2
+ {
3
+ /// <summary>
4
+ /// Const-int positions into <c>MessageBus._scalarSinks[]</c>. Indices are
5
+ /// hand-written so call sites inline as immediate operands. Array lengths,
6
+ /// populated-non-null slot identities, and reserved-null slot identities
7
+ /// are validated in DEBUG builds via <c>MessageBus.ValidateSinkArrays()</c>.
8
+ /// </summary>
9
+ /// <remarks>
10
+ /// Slot 0 (<see cref="UntargetedHandleDefault"/>) holds the
11
+ /// <c>RegisterUntargeted</c> Handle-phase cache.
12
+ /// Slot 1 (<see cref="BroadcastHandleWithoutContext"/>) holds the
13
+ /// <c>RegisterSourcedBroadcastWithoutSource</c> Handle-phase cache.
14
+ /// Slot 2 (<see cref="TargetedHandleWithoutContext"/>) holds the
15
+ /// <c>RegisterTargetedWithoutTargeting</c> Handle-phase cache.
16
+ /// Slot 3 (<see cref="UntargetedPostProcessDefault"/>) holds the
17
+ /// <c>RegisterUntargetedPostProcessor</c> PostProcess-phase cache.
18
+ /// Slot 4 (<see cref="TargetedPostProcessWithoutContext"/>) holds the
19
+ /// <c>RegisterTargetedWithoutTargetingPostProcessor</c> PostProcess-phase cache.
20
+ /// Slot 5 (<see cref="BroadcastPostProcessWithoutContext"/>) holds the
21
+ /// <c>RegisterBroadcastWithoutSourcePostProcessor</c> PostProcess-phase cache.
22
+ /// Slots 6-7 (<see cref="Reserved6"/>, <see cref="Reserved7"/>) are permanent
23
+ /// future-expansion stubs and remain null.
24
+ /// </remarks>
25
+ internal static class BusSinkIndex
26
+ {
27
+ // "WithoutContext" unifies the legacy "WithoutTargeting" (Targeted) and
28
+ // "WithoutSource" (Broadcast) per-axis variants -- both lack an InstanceId.
29
+ public const int UntargetedHandleDefault = 0;
30
+ public const int BroadcastHandleWithoutContext = 1;
31
+ public const int TargetedHandleWithoutContext = 2;
32
+ public const int UntargetedPostProcessDefault = 3;
33
+ public const int TargetedPostProcessWithoutContext = 4;
34
+ public const int BroadcastPostProcessWithoutContext = 5;
35
+ public const int Reserved6 = 6;
36
+ public const int Reserved7 = 7;
37
+
38
+ public const int Length = 8;
39
+ }
40
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 91d17e8c1a5d49ff8a5eeb05f0bf45f2
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: