gvisorgvisor.dev/gvisor/pkg/sentry/uniqueid Index | Files

package uniqueid

import "gvisor.dev/gvisor/pkg/sentry/uniqueid"

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

Index

Constants

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
)

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.

Source Files

context.go

Version
v0.0.0-20250802011938-fc9c972fa636 (latest)
Published
Aug 2, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
1 hour ago

Tools for package owners.