model

package
v0.0.0-...-a166214 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package model holds model related files

Package model holds model related files

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoImageProvided = errors.New("no image name provided") // ErrNoImageProvided is returned when no image name is provided
)

Functions

func WorkloadSelectorToProto

func WorkloadSelectorToProto(input *WorkloadSelector) *proto.ProfileSelector

WorkloadSelectorToProto incode a WorkloadSelector to its protobuf representation

Types

type CacheEntry

type CacheEntry struct {
	model.CGroupContext
	model.ContainerContext
	sync.RWMutex
	Deleted          *atomic.Bool
	WorkloadSelector WorkloadSelector
	PIDs             map[uint32]bool
}

CacheEntry cgroup resolver cache entry

func NewCacheEntry

func NewCacheEntry(containerID string, cgroupFlags uint64, pids ...uint32) (*CacheEntry, error)

NewCacheEntry returns a new instance of a CacheEntry

func (*CacheEntry) AddPID

func (cgce *CacheEntry) AddPID(pid uint32)

AddPID adds a pid to the list of pids

func (*CacheEntry) GetPIDs

func (cgce *CacheEntry) GetPIDs() []uint32

GetPIDs returns the list of pids for the current workload

func (*CacheEntry) GetWorkloadSelectorCopy

func (cgce *CacheEntry) GetWorkloadSelectorCopy() *WorkloadSelector

GetWorkloadSelectorCopy returns a copy of the workload selector of this cgroup

func (*CacheEntry) NeedsTagsResolution

func (cgce *CacheEntry) NeedsTagsResolution() bool

NeedsTagsResolution returns true if this workload is missing its tags

func (*CacheEntry) RemovePID

func (cgce *CacheEntry) RemovePID(pid uint32)

RemovePID removes the provided pid from the list of pids

func (*CacheEntry) SetTags

func (cgce *CacheEntry) SetTags(tags []string)

SetTags sets the tags for the provided workload

type WorkloadSelector

type WorkloadSelector struct {
	Image string
	Tag   string
}

WorkloadSelector is a selector used to uniquely indentify the image of a workload

func NewWorkloadSelector

func NewWorkloadSelector(image string, tag string) (WorkloadSelector, error)

NewWorkloadSelector returns an initialized instance of a WorkloadSelector

func ProtoToWorkloadSelector

func ProtoToWorkloadSelector(selector *proto.ProfileSelector) WorkloadSelector

ProtoToWorkloadSelector decodes a Selector structure

func (*WorkloadSelector) IsReady

func (ws *WorkloadSelector) IsReady() bool

IsReady returns true if the selector is ready

func (*WorkloadSelector) Match

func (ws *WorkloadSelector) Match(selector WorkloadSelector) bool

Match returns true if the input selector matches the current selector

func (WorkloadSelector) String

func (ws WorkloadSelector) String() string

String returns a string representation of a workload selector

func (WorkloadSelector) ToTags

func (ws WorkloadSelector) ToTags() []string

ToTags returns a string array representation of a workload selector

Jump to

Keyboard shortcuts

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