Documentation ¶
Overview ¶
Package sessionpool implements a reuse pool for session IDs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionPool ¶
type SessionPool struct {
// contains filtered or unexported fields
}
A SessionPool is a pool for session IDs. IDs are re-used in MRU order, for ease of implementation in Go.
func (*SessionPool) EnableUseTracking ¶
func (pool *SessionPool) EnableUseTracking()
Enable use-tracking for the SessionPool.
When enabled, the SessionPool stores all session IDs returned by Get() internally. When an ID is reclaimed, the SessionPool checks whether the ID being reclaimed is in its list of used IDs. If this is not the case, the program will panic.
func (*SessionPool) Get ¶
func (pool *SessionPool) Get() (id uint32)
Get a new session ID from the SessionPool. Must be reclaimed using Reclaim() when done using it.
func (*SessionPool) Reclaim ¶
func (pool *SessionPool) Reclaim(id uint32)
Reclaim a session ID so it can be reused.
Click to show internal directories.
Click to hide internal directories.