local

package
v0.0.0-...-c4caace Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeTagger

type FakeTagger struct {
	sync.RWMutex
	// 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 collectors.TagCardinality, tb tagset.TagAccumulator) 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) Init

func (f *FakeTagger) Init() error

Init not implemented in fake tagger

func (*FakeTagger) List

List fake implementation

func (*FakeTagger) SetError

func (f *FakeTagger) SetError(entity string, cardinality collectors.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) 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 []*collectors.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) Stop

func (f *FakeTagger) Stop() error

Stop not implemented in fake tagger

func (*FakeTagger) Subscribe

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

Subscribe fake implementation

func (*FakeTagger) Tag

func (f *FakeTagger) Tag(entity string, cardinality collectors.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
	// contains filtered or unexported fields
}

Tagger is the entry class for entity tagging. It holds collectors, memory store and handles the query logic. One can use the package methods to use the default Tagger instead of instantiating one.

func NewTagger

func NewTagger(catalog collectors.Catalog) *Tagger

NewTagger returns an allocated tagger. You still have to run Init() once the config package is ready. 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 collectors.TagCardinality, tb tagset.TagAccumulator) error

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

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) Init

func (t *Tagger) Init() error

Init goes through a catalog and tries to detect which are relevant for this host. It then starts the collection logic and is ready for requests.

func (*Tagger) List

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) Stop

func (t *Tagger) Stop() error

Stop queues a shutdown of Tagger

func (*Tagger) Subscribe

func (t *Tagger) Subscribe(cardinality collectors.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 collectors.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