EntropyEngine::Networking::SchemaNackPolicy
EntropyEngine::Networking::SchemaNackPolicy
Section titled “EntropyEngine::Networking::SchemaNackPolicy”Global, thread-safe policy for schema NACK behavior. More…
#include <SchemaNackPolicy.h>
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| void | setMinIntervalMs(uint32_t intervalMs) Set the minimum interval between NACKs. |
| void | setLogIntervalMs(uint32_t intervalMs) Set the logging interval. |
| void | setBurst(uint32_t burstCount) Set the burst allowance. |
| bool | isEnabled() const Check if NACK sending is enabled. |
| SchemaNackPolicy & | instance() Get the global NACK policy instance. |
| uint32_t | getMinIntervalMs() const Get the minimum interval between NACKs in milliseconds. |
| uint32_t | getLogIntervalMs() const Get the logging interval in milliseconds. |
| uint32_t | getBurst() const Get the burst allowance. |
| void | enable() Enable NACK sending. |
| void | disable() Disable NACK sending. |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| std::atomic< uint32_t > | minIntervalMs Minimum interval between NACKs for same schema in milliseconds (default: 1000ms). |
| std::atomic< uint32_t > | logIntervalMs Interval for rate-limited logging of unknown schema events in milliseconds (default: 5000ms). |
| std::atomic< bool > | enabled Enable/disable sending NACK messages (default: false) When false, unknown schemas are logged and counted but no NACKs are sent. |
| std::atomic< uint32_t > | burst Maximum burst of NACKs allowed before rate limiting kicks in (default: 1). |
Detailed Description
Section titled “Detailed Description”struct EntropyEngine::Networking::SchemaNackPolicy;Global, thread-safe policy for schema NACK behavior.
Controls whether SchemaNack messages are sent when encountering unknown ComponentTypeHash values in received messages (e.g., ENTITY_CREATED with unknown schemas).
SchemaNack is OPTIONAL feedback:
- Default: disabled (no NACKs sent)
- Applications choose to enable based on their requirements
- Used for schema discovery and debugging unknown schema issues
Behavior when unknown schema detected:
- ALWAYS: Increment unknownSchemaDrops metric (NetworkSession::getUnknownSchemaDropCount)
- ALWAYS: Emit rate-limited log with schema hash and error code
- IF ENABLED: Send SchemaNack message to peer (subject to per-schema rate limiting)
All operations use atomics for lock-free access in hot paths. Thread-safe: All fields are atomic and can be safely accessed from multiple threads.
Public Functions Documentation
Section titled “Public Functions Documentation”function setMinIntervalMs
Section titled “function setMinIntervalMs”inline void setMinIntervalMs( uint32_t intervalMs)Set the minimum interval between NACKs.
Parameters:
- intervalMs Interval in milliseconds
function setLogIntervalMs
Section titled “function setLogIntervalMs”inline void setLogIntervalMs( uint32_t intervalMs)Set the logging interval.
Parameters:
- intervalMs Interval in milliseconds
function setBurst
Section titled “function setBurst”inline void setBurst( uint32_t burstCount)Set the burst allowance.
Parameters:
- burstCount Maximum burst count
function isEnabled
Section titled “function isEnabled”inline bool isEnabled() constCheck if NACK sending is enabled.
Return: true if NACKs should be sent
function instance
Section titled “function instance”static inline SchemaNackPolicy & instance()Get the global NACK policy instance.
Return: Reference to the global policy
Singleton accessor for the global policy. Thread-safe lazy initialization.
function getMinIntervalMs
Section titled “function getMinIntervalMs”inline uint32_t getMinIntervalMs() constGet the minimum interval between NACKs in milliseconds.
Return: Minimum interval in ms
function getLogIntervalMs
Section titled “function getLogIntervalMs”inline uint32_t getLogIntervalMs() constGet the logging interval in milliseconds.
Return: Log interval in ms
function getBurst
Section titled “function getBurst”inline uint32_t getBurst() constGet the burst allowance.
Return: Maximum burst count
function enable
Section titled “function enable”inline void enable()Enable NACK sending.
function disable
Section titled “function disable”inline void disable()Disable NACK sending.
Public Attributes Documentation
Section titled “Public Attributes Documentation”variable minIntervalMs
Section titled “variable minIntervalMs”std::atomic< uint32_t > minIntervalMs {1000};Minimum interval between NACKs for same schema in milliseconds (default: 1000ms).
variable logIntervalMs
Section titled “variable logIntervalMs”std::atomic< uint32_t > logIntervalMs {5000};Interval for rate-limited logging of unknown schema events in milliseconds (default: 5000ms).
variable enabled
Section titled “variable enabled”std::atomic< bool > enabled {false};Enable/disable sending NACK messages (default: false) When false, unknown schemas are logged and counted but no NACKs are sent.
variable burst
Section titled “variable burst”std::atomic< uint32_t > burst {1};Maximum burst of NACKs allowed before rate limiting kicks in (default: 1).
Updated on 2026-01-26 at 17:14:35 -0500