Documentation
¶
Overview ¶
Package local implements a local Tagger.
Index ¶
- type FakeTagger
- func (f *FakeTagger) AccumulateTagsFor(entity string, cardinality types.TagCardinality, tb tagset.TagsAccumulator) error
- func (f *FakeTagger) GetEntity(entityID string) (*types.Entity, error)
- func (f *FakeTagger) GlobalTags(cardinality types.TagCardinality) ([]string, error)
- func (f *FakeTagger) List() types.TaggerListResponse
- func (f *FakeTagger) SetError(entity string, cardinality types.TagCardinality, err error)
- func (f *FakeTagger) SetGlobalTags(low, orch, high, std []string)
- func (f *FakeTagger) SetTags(entity, source string, low, orch, high, std []string)
- func (f *FakeTagger) SetTagsFromInfo(tags []*types.TagInfo)
- func (f *FakeTagger) Standard(entity string) ([]string, error)
- func (f *FakeTagger) Start(_ context.Context) error
- func (f *FakeTagger) Stop() error
- func (f *FakeTagger) Subscribe(cardinality types.TagCardinality) chan []types.EntityEvent
- func (f *FakeTagger) Tag(entity string, cardinality types.TagCardinality) ([]string, error)
- func (f *FakeTagger) Unsubscribe(ch chan []types.EntityEvent)
- type Tagger
- func (t *Tagger) AccumulateTagsFor(entity string, cardinality types.TagCardinality, tb tagset.TagsAccumulator) error
- func (t *Tagger) GetEntity(entityID string) (*types.Entity, error)
- func (t *Tagger) List() types.TaggerListResponse
- func (t *Tagger) Standard(entity string) ([]string, error)
- func (t *Tagger) Start(ctx context.Context) error
- func (t *Tagger) Stop() error
- func (t *Tagger) Subscribe(cardinality types.TagCardinality) chan []types.EntityEvent
- func (t *Tagger) Tag(entity string, cardinality types.TagCardinality) ([]string, error)
- func (t *Tagger) Unsubscribe(ch chan []types.EntityEvent)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeTagger ¶
FakeTagger implements the Tagger interface
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 ¶
func (f *FakeTagger) List() types.TaggerListResponse
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) 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 ¶
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 ¶
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 ¶
Standard returns standard tags for a given entity It triggers a tagger fetch if the no tags are found
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) Unsubscribe ¶
func (t *Tagger) Unsubscribe(ch chan []types.EntityEvent)
Unsubscribe ends a subscription to entity events and closes its channel.