session

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package session provides machine-wide unique sessions.

A session is a small unique integer, which is tied to a process id (PID) and may typically be used to create a unique local IP address.

Note, this package was implemented to provide a smooth migration from Nokia internal test tool (k3-run) to ntt and maybe replaced in the future.

Index

Constants

This section is empty.

Variables

View Source
var SharedDir = "/tmp/k3"

Functions

func Clean

func Clean(sessions []session) []session

Clean returns a slice of alive sessions

func Get

func Get() (int, error)

Get returns the next free unqiue seesion id. If an error occures, Get returns -1 and the error.

func New

func New(path string) (*storage, error)

New returns a new storage. The backing path is evaulated lazily and may contain active sessions, if path does not exist it will be created.

func Release added in v0.16.2

func Release(s int)

func Sort

func Sort(sessions []session)

Types

type SessionSlice

type SessionSlice []session

func (SessionSlice) Len

func (s SessionSlice) Len() int

func (SessionSlice) Less

func (s SessionSlice) Less(i, j int) bool

func (SessionSlice) Swap

func (s SessionSlice) Swap(i, j int)

Directories

Path Synopsis
Package flock implements a thread-safe interface for file locking.
Package flock implements a thread-safe interface for file locking.

Jump to

Keyboard shortcuts

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