package idm
import "github.com/moby/swarmkit/v2/internal/idm"
Package idm manages reservation/release of numerical ids from a configured set of contiguous ids.
Index ¶
Variables ¶
var ( // ErrNoBitAvailable is returned when no more bits are available to set ErrNoBitAvailable = errors.New("no bit available") // ErrBitAllocated is returned when the specific bit requested is already set ErrBitAllocated = errors.New("requested bit is already allocated") )
Types ¶
type IDM ¶
type IDM struct {
// contains filtered or unexported fields
}
IDM manages the reservation/release of numerical ids from a contiguous set.
An IDM instance is not safe for concurrent use.
func New ¶
New returns an instance of id manager for a [start,end] set of numerical ids.
func (*IDM) GetID ¶
GetID returns the first available id in the set.
func (*IDM) GetSpecificID ¶
GetSpecificID tries to reserve the specified id.
func (*IDM) Release ¶
Release releases the specified id.
Source Files ¶
- Version
- v2.0.0-20250103191802-8c1959736554 (latest)
- Published
- Jan 3, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 2 weeks ago –
Tools for package owners.