SnmpKit.SnmpMgr.RequestIdGenerator (snmpkit v0.6.3)
Atomic request ID generator using ETS for thread-safe counter operations.
Provides unique request IDs for SNMP operations without requiring GenServer synchronization, eliminating serialization bottlenecks.
Summary
Functions
Returns a specification to start this module under a supervisor.
Gets the current counter value without incrementing.
Generates the next unique request ID.
Resets the counter to 0.
Starts the RequestIdGenerator GenServer.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Gets the current counter value without incrementing.
Useful for debugging and monitoring.
Generates the next unique request ID.
Uses atomic ETS operations for thread-safe counter increment. Wraps around at 1000000 to prevent overflow.
Examples
iex> SnmpKit.SnmpMgr.RequestIdGenerator.next_id()
1
iex> SnmpKit.SnmpMgr.RequestIdGenerator.next_id()
2
Resets the counter to 0.
Primarily used for testing.
Starts the RequestIdGenerator GenServer.
Creates the ETS table for atomic counter operations.