uniqueid

package
v0.0.0-...-957f62e Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0, MIT Imports: 1 Imported by: 0

Documentation

Overview

Package uniqueid defines context.Context keys for obtaining system-wide unique identifiers.

Index

Constants

View Source
const (
	// CtxGlobalUniqueID is a Context.Value key for a system-wide
	// unique identifier.
	CtxGlobalUniqueID contextID = iota

	// CtxGlobalUniqueIDProvider is a Context.Value key for a
	// system-wide unique identifier generator.
	CtxGlobalUniqueIDProvider

	// CtxInotifyCookie is a Context.Value key for a unique inotify
	// event cookie.
	CtxInotifyCookie
)

Variables

This section is empty.

Functions

func GlobalFromContext

func GlobalFromContext(ctx context.Context) uint64

GlobalFromContext returns a system-wide unique identifier from ctx.

func InotifyCookie

func InotifyCookie(ctx context.Context) uint32

InotifyCookie generates a unique inotify event cookie from ctx.

Types

type Provider

type Provider interface {
	// UniqueID returns a new unique identifier.
	UniqueID() uint64
}

Provider generates a sequence of unique identifiers useful for, among other things, lock ordering.

func GlobalProviderFromContext

func GlobalProviderFromContext(ctx context.Context) Provider

GlobalProviderFromContext returns a system-wide unique identifier from ctx.

Jump to

Keyboard shortcuts

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