Skip to content

EntropyEngine::Networking::SchemaNackPolicy

EntropyEngine::Networking::SchemaNackPolicy

Section titled “EntropyEngine::Networking::SchemaNackPolicy”

Global, thread-safe policy for schema NACK behavior. More…

#include <SchemaNackPolicy.h>

Name
voidsetMinIntervalMs(uint32_t intervalMs)
Set the minimum interval between NACKs.
voidsetLogIntervalMs(uint32_t intervalMs)
Set the logging interval.
voidsetBurst(uint32_t burstCount)
Set the burst allowance.
boolisEnabled() const
Check if NACK sending is enabled.
SchemaNackPolicy &instance()
Get the global NACK policy instance.
uint32_tgetMinIntervalMs() const
Get the minimum interval between NACKs in milliseconds.
uint32_tgetLogIntervalMs() const
Get the logging interval in milliseconds.
uint32_tgetBurst() const
Get the burst allowance.
voidenable()
Enable NACK sending.
voiddisable()
Disable NACK sending.
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).
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.

inline void setMinIntervalMs(
uint32_t intervalMs
)

Set the minimum interval between NACKs.

Parameters:

  • intervalMs Interval in milliseconds
inline void setLogIntervalMs(
uint32_t intervalMs
)

Set the logging interval.

Parameters:

  • intervalMs Interval in milliseconds
inline void setBurst(
uint32_t burstCount
)

Set the burst allowance.

Parameters:

  • burstCount Maximum burst count
inline bool isEnabled() const

Check if NACK sending is enabled.

Return: true if NACKs should be sent

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.

inline uint32_t getMinIntervalMs() const

Get the minimum interval between NACKs in milliseconds.

Return: Minimum interval in ms

inline uint32_t getLogIntervalMs() const

Get the logging interval in milliseconds.

Return: Log interval in ms

inline uint32_t getBurst() const

Get the burst allowance.

Return: Maximum burst count

inline void enable()

Enable NACK sending.

inline void disable()

Disable NACK sending.

std::atomic< uint32_t > minIntervalMs {1000};

Minimum interval between NACKs for same schema in milliseconds (default: 1000ms).

std::atomic< uint32_t > logIntervalMs {5000};

Interval for rate-limited logging of unknown schema events in milliseconds (default: 5000ms).

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.

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