local

package
v0.0.0-...-304f7d3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package local implements a local Tagger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeTagger

type FakeTagger struct {
	sync.RWMutex
	empty.Tagger
	// contains filtered or unexported fields
}

FakeTagger implements the Tagger interface

func NewFakeTagger

func NewFakeTagger() *FakeTagger

NewFakeTagger returns a new fake Tagger

func (*FakeTagger) AccumulateTagsFor

func (f *FakeTagger) AccumulateTagsFor(entity string, cardinality types.TagCardinality, tb tagset.TagsAccumulator) error

AccumulateTagsFor fake implementation

func (*FakeTagger) GetEntity

func (f *FakeTagger) GetEntity(entityID string) (*types.Entity, error)

GetEntity returns faked entity corresponding to the specified id and an error

func (*FakeTagger) GlobalTags

func (f *FakeTagger) GlobalTags(cardinality types.TagCardinality) ([]string, error)

GlobalTags fake implementation

func (*FakeTagger) List

List fake implementation

func (*FakeTagger) SetError

func (f *FakeTagger) SetError(entity string, cardinality types.TagCardinality, err error)

SetError allows to set an error to be returned when `Tag` or `AccumulateTagsFor` is called for this entity and cardinality

func (*FakeTagger) SetGlobalTags

func (f *FakeTagger) SetGlobalTags(low, orch, high, std []string)

SetGlobalTags allows to set tags in store for the global entity

func (*FakeTagger) SetTags

func (f *FakeTagger) SetTags(entity, source string, low, orch, high, std []string)

SetTags allows to set tags in store for a given source, entity

func (*FakeTagger) SetTagsFromInfo

func (f *FakeTagger) SetTagsFromInfo(tags []*types.TagInfo)

SetTagsFromInfo allows to set tags from list of TagInfo

func (*FakeTagger) Standard

func (f *FakeTagger) Standard(entity string) ([]string, error)

Standard fake implementation

func (*FakeTagger) Start

func (f *FakeTagger) Start(_ context.Context) error

Start not implemented in fake tagger

func (*FakeTagger) Stop

func (f *FakeTagger) Stop() error

Stop not implemented in fake tagger

func (*FakeTagger) Subscribe

func (f *FakeTagger) Subscribe(cardinality types.TagCardinality) chan []types.EntityEvent

Subscribe fake implementation

func (*FakeTagger) Tag

func (f *FakeTagger) Tag(entity string, cardinality types.TagCardinality) ([]string, error)

Tag fake implementation

func (*FakeTagger) Unsubscribe

func (f *FakeTagger) Unsubscribe(ch chan []types.EntityEvent)

Unsubscribe fake implementation

type Tagger

type Tagger struct {
	sync.RWMutex

	empty.Tagger
	// contains filtered or unexported fields
}

Tagger is the entry class for entity tagging. It hold the tagger collector, memory store, and handles the query logic. One should use the package methods in comp/core/tagger to use the default Tagger instead of instantiating it directly.

func NewTagger

func NewTagger(workloadStore workloadmeta.Component) *Tagger

NewTagger returns an allocated tagger. You are probably looking for tagger.Tag() using the global instance instead of creating your own.

func (*Tagger) AccumulateTagsFor

func (t *Tagger) AccumulateTagsFor(entity string, cardinality types.TagCardinality, tb tagset.TagsAccumulator) error

AccumulateTagsFor appends tags for a given entity from the tagger to the TagsAccumulator

func (*Tagger) GetEntity

func (t *Tagger) GetEntity(entityID string) (*types.Entity, error)

GetEntity returns the entity corresponding to the specified id and an error

func (*Tagger) List

func (t *Tagger) List() types.TaggerListResponse

List the content of the tagger

func (*Tagger) Standard

func (t *Tagger) Standard(entity string) ([]string, error)

Standard returns standard tags for a given entity It triggers a tagger fetch if the no tags are found

func (*Tagger) Start

func (t *Tagger) Start(ctx context.Context) error

Start starts the workloadmeta collector and then it is ready for requests.

func (*Tagger) Stop

func (t *Tagger) Stop() error

Stop queues a shutdown of Tagger

func (*Tagger) Subscribe

func (t *Tagger) Subscribe(cardinality types.TagCardinality) chan []types.EntityEvent

Subscribe returns a channel that receives a slice of events whenever an entity is added, modified or deleted. It can send an initial burst of events only to the new subscriber, without notifying all of the others.

func (*Tagger) Tag

func (t *Tagger) Tag(entity string, cardinality types.TagCardinality) ([]string, error)

Tag returns a copy of the tags for a given entity

func (*Tagger) Unsubscribe

func (t *Tagger) Unsubscribe(ch chan []types.EntityEvent)

Unsubscribe ends a subscription to entity events and closes its channel.

Jump to

Keyboard shortcuts

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