id

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ServerStringIDBase uint32 = 0x80000000

ServerStringIDBase is the base offset for server-only string IDs to prevent collisions with client string IDs.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

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

Generator generates unique IDs for different namespaces. It is safe for concurrent use.

func NewGenerator

func NewGenerator() *Generator

NewGenerator creates a new Generator initialized with starting counter values.

func (*Generator) New

func (g *Generator) New(ns Namespace) uint32

New allocates a fresh uint32 ID in the given namespace. IDs start from 1 (or ServerStringIDBase + 1 for ServerString).

func (*Generator) Set

func (g *Generator) Set(ns Namespace, value uint32)

Set sets the current value of the ID counter for the given namespace.

type Namespace

type Namespace uint32

Namespace represents a namespace for generating unique IDs.

const (
	// String is the namespace for string IDs.
	String Namespace = iota
	// ServerString is the namespace for server-only string IDs.
	ServerString
	// FieldSet is the namespace for field set IDs.
	FieldSet
	// Struct is the namespace for struct IDs.
	Struct
	// TimelinePath is the namespace for timeline path IDs.
	TimelinePath
	// TimelineItems is the namespace for timeline items IDs.
	TimelineItems
	// TemporaryLog is the namespace for parser-side temporary log IDs.
	TemporaryLog
	// Log is the namespace for finalized/serialized log IDs.
	Log
)

Jump to

Keyboard shortcuts

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