sessionpool

package module
v0.0.0-...-042ca66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

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 New

func New() (pool *SessionPool)

Create a new SessionPool container.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL