context

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnrichFields

type EnrichFields struct {
	// contains filtered or unexported fields
}

EnrichFields is a simple include/exclude ruleset.

func NewEnrichFields

func NewEnrichFields(include, exclude string) EnrichFields

NewEnrichFields only works on include if not empty, otherwise exclude. include and exclude must be strings of the form:

"field1,field2,field3"

Any field containing a coma is not supported through the constructor, use AddInclude/AddExclude manually.

func (*EnrichFields) AddExclude

func (ef *EnrichFields) AddExclude(field string)

AddExclude ...

func (*EnrichFields) AddInclude

func (ef *EnrichFields) AddInclude(field string)

AddInclude ...

func (*EnrichFields) Allow

func (ef *EnrichFields) Allow(field string) bool

Allow returns true if the given field is part of included fields or not in excluded fields.

func (*EnrichFields) DelExclude

func (ef *EnrichFields) DelExclude(field string)

DelExclude ...

func (*EnrichFields) DelInclude

func (ef *EnrichFields) DelInclude(field string)

DelInclude ...

type EnrichmentCenter

type EnrichmentCenter interface {
	// Handle context creation and update on received event.
	// param source: the original event as byte slice.
	// param ef: which fields are included/excluded from extra infos enrichment.
	//     see EnrichFields doc for more infos.
	Handle(ctx context.Context, event types.Event, ef EnrichFields) (*types.Entity, UpdatedEntityServices, error)

	// HandleEntityServiceUpdate updates context graph for entity service.
	HandleEntityServiceUpdate(ctx context.Context, serviceID string) (*UpdatedEntityServices, error)

	// Get finds entity for event.
	Get(event types.Event) (*types.Entity, error)

	// UpdateEntityInfos updates an entity.
	// It also recomputes the link between the entity and the services, since
	// those may be changed by the modifications of the entity, and returns the
	// modified entity.
	UpdateEntityInfos(ctx context.Context, entity *types.Entity) (UpdatedEntityServices, error)

	// UpdateImpactedServices updates the impacted_services field in connector documents
	UpdateImpactedServices(ctx context.Context) error

	// LoadServices loads services from storage to cache.
	LoadServices(ctx context.Context) error

	// ReloadService loads service from storage to cache.
	ReloadService(ctx context.Context, serviceID string) error
}

EnrichmentCenter is the high level API for context management.

func NewEnrichmentCenter

func NewEnrichmentCenter(
	adapter libentity.Adapter,
	enableEnrich bool,
	entityServiceManager entityservice.Manager,
	logger zerolog.Logger,
) EnrichmentCenter

type UpdatedEntityServices

type UpdatedEntityServices struct {
	// AddedTo contains ids of entity services to which entity has been
	// added as dependency.
	AddedTo []string
	// RemovedFrom contains ids of entity services from which entity has been
	// removed as dependency.
	RemovedFrom []string
	// UpdatedComponentInfosResources contains ids of entities which component infos
	// were updated on component event.
	UpdatedComponentInfosResources []string
}

UpdatedEntityServices represents changes in context graph.

func (UpdatedEntityServices) Add

Jump to

Keyboard shortcuts

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