tagstore

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: 18 Imported by: 0

Documentation

Overview

Package tagstore implements the TagStore which is the component of the Tagger responsible for storing the tags in memory.

Index

Constants

This section is empty.

Variables

View Source
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

type TagStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TagStore stores entity tags in memory and handles search and collation. Queries should go through the Tagger for cache-miss handling

func NewTagStore

func NewTagStore() *TagStore

NewTagStore creates new TagStore.

func (*TagStore) GetEntity

func (s *TagStore) GetEntity(entityID string) (*types.Entity, error)

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

func (s *TagStore) LookupStandard(entityID string) ([]string, error)

LookupStandard returns the standard tags recorded for a given entity

func (*TagStore) ProcessTagInfo

func (s *TagStore) ProcessTagInfo(tagInfos []*types.TagInfo)

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

func (s *TagStore) Run(ctx context.Context)

Run performs background maintenance for TagStore.

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.

Jump to

Keyboard shortcuts

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