contextdetection

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidMntns = errors.New("invalid mount namespace ID: cannot be zero")
)

Functions

This section is empty.

Types

type ContextDetector

type ContextDetector interface {
	Detect(container *containercollection.Container) (ContextInfo, bool)
	Priority() int
}

type ContextInfo

type ContextInfo interface {
	Context() EventSourceContext
	WorkloadID() string
}

type EventSourceContext

type EventSourceContext string
const (
	Kubernetes EventSourceContext = "kubernetes"
	Host       EventSourceContext = "host"
	Standalone EventSourceContext = "standalone"
)

type MntnsRegistry

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

MntnsRegistry maps mount namespace IDs to their context information.

func NewMntnsRegistry

func NewMntnsRegistry() *MntnsRegistry

NewMntnsRegistry creates a new MntnsRegistry instance. The hostMntns should be set separately via SetHostMntns after initialization.

func (*MntnsRegistry) Lookup

func (r *MntnsRegistry) Lookup(mntns uint64) (ContextInfo, bool)

Lookup retrieves the context information for a mount namespace.

func (*MntnsRegistry) Register

func (r *MntnsRegistry) Register(mntns uint64, info ContextInfo) error

Register adds or updates a mount namespace entry in the registry.

func (*MntnsRegistry) Unregister

func (r *MntnsRegistry) Unregister(mntns uint64)

Unregister removes a mount namespace entry from the registry.

type Registry

type Registry interface {
	// Register adds or updates a mount namespace entry in the registry.
	// Returns an error if the mount namespace ID is invalid (zero).
	Register(mntns uint64, info ContextInfo) error

	// Lookup retrieves the context information for a mount namespace.
	// Returns the context info and true if found, false otherwise.
	Lookup(mntns uint64) (ContextInfo, bool)

	// Unregister removes a mount namespace entry from the registry.
	Unregister(mntns uint64)
}

Registry defines the interface for managing mount namespace to context mappings.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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