Documentation ¶
Overview ¶
Package tagstore implements the TagStore which is the component of the Tagger responsible for storing the tags in memory.
Index ¶
- Variables
- type EntityTags
- type EntityTagsWithMultipleSources
- type EntityTagsWithSingleSource
- type TagStore
- func (s *TagStore) GetEntity(entityID string) (*types.Entity, error)
- func (s *TagStore) List() types.TaggerListResponse
- func (s *TagStore) Lookup(entity string, cardinality types.TagCardinality) []string
- func (s *TagStore) LookupHashed(entity string, cardinality types.TagCardinality) tagset.HashedTags
- func (s *TagStore) LookupStandard(entityID string) ([]string, error)
- func (s *TagStore) ProcessTagInfo(tagInfos []*types.TagInfo)
- func (s *TagStore) Prune()
- func (s *TagStore) Run(ctx context.Context)
- func (s *TagStore) Subscribe(cardinality types.TagCardinality) chan []types.EntityEvent
- func (s *TagStore) Unsubscribe(ch chan []types.EntityEvent)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("entity not found")
ErrNotFound is returned when entity id is not found in the store.
Functions ¶
This section is empty.
Types ¶
type EntityTags ¶
type EntityTags interface {
// contains filtered or unexported methods
}
EntityTags holds the tag information for a given entity.
type EntityTagsWithMultipleSources ¶
type EntityTagsWithMultipleSources struct {
// contains filtered or unexported fields
}
EntityTagsWithMultipleSources holds the tag information for a given entity that can be created from multiple sources. It is not thread-safe, so should not be shared outside of the store. Usage inside the store is safe since it relies on a global lock.
type EntityTagsWithSingleSource ¶
type EntityTagsWithSingleSource struct {
// contains filtered or unexported fields
}
EntityTagsWithSingleSource holds the tag information for a given entity that can only be created from a single source. It is not thread-safe, so should not be shared outside of the store. Usage inside the store is safe since it relies on a global lock.
type TagStore ¶
TagStore stores entity tags in memory and handles search and collation. Queries should go through the Tagger for cache-miss handling
func (*TagStore) GetEntity ¶
GetEntity returns the entity corresponding to the specified id and an error
func (*TagStore) List ¶
func (s *TagStore) List() types.TaggerListResponse
List returns full list of entities and their tags per source in an API format.
func (*TagStore) Lookup ¶
func (s *TagStore) Lookup(entity string, cardinality types.TagCardinality) []string
Lookup gets tags from the store and returns them concatenated in a string slice.
func (*TagStore) LookupHashed ¶
func (s *TagStore) LookupHashed(entity string, cardinality types.TagCardinality) tagset.HashedTags
LookupHashed gets tags from the store and returns them as a HashedTags instance.
func (*TagStore) LookupStandard ¶
LookupStandard returns the standard tags recorded for a given entity
func (*TagStore) ProcessTagInfo ¶
ProcessTagInfo updates tagger store with tags fetched by collectors.
func (*TagStore) Prune ¶
func (s *TagStore) Prune()
Prune deletes tags for entities that have been marked as deleted. This is to be called regularly from the user class.
func (*TagStore) Subscribe ¶
func (s *TagStore) 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 (*TagStore) Unsubscribe ¶
func (s *TagStore) Unsubscribe(ch chan []types.EntityEvent)
Unsubscribe ends a subscription to entity events and closes its channel.