namepool

package
v0.0.0-...-b779cef Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

The package namepool is used to provide a name pool that contains names that are safe to use by multiple goroutines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pool

func Pool(format string) *pool

Pool is a wrapper around a sync.Pool utilizing sync/atomic to provide simple name pools that are safe to use by multiple goroutines.

The argument format should include exactly one format verb for base 10 integers (%d). It is not an error if format doesn't include any verbs. The ID will still be stored in acquired Names.

Types

type Name

type Name struct {
	// contains filtered or unexported fields
}

Name is a member of a Pool. It contains the formatted string of the format and the ID as well as the ID itself.

func (Name) ID

func (name Name) ID() uint64

ID returns the id of name.

func (Name) Name

func (name Name) Name() string

Name returns the name of name.

func (*Name) Release

func (name *Name) Release()

Release calls to the Names' Pool to release itself. The restrictions and affects of Pool.Release apply.

func (Name) String

func (name Name) String() string

Jump to

Keyboard shortcuts

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