contextgraph

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package contextgraph contains a service, which is responsible for building canopsis context graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityServiceStorage

type EntityServiceStorage interface {
	GetAll(ctx context.Context) ([]entityservice.EntityService, error)
	Get(ctx context.Context, serviceID string) (entityservice.EntityService, error)
}

func NewEntityServiceStorage

func NewEntityServiceStorage(client mongo.DbClient) EntityServiceStorage

type Manager

type Manager interface {
	// HandleResource processes resource event.
	HandleResource(ctx context.Context, event *types.Event, commRegister mongo.CommandsRegister) (Report, error)
	// HandleComponent processes component event.
	HandleComponent(ctx context.Context, event *types.Event, commRegister mongo.CommandsRegister) (Report, error)
	// HandleConnector processes connector event.
	HandleConnector(ctx context.Context, event *types.Event, commRegister mongo.CommandsRegister) (Report, error)
	// HandleService processes service event.
	HandleService(ctx context.Context, event *types.Event, commRegister mongo.CommandsRegister) (Report, error)
	// LoadServices refreshes slice of available services. Should be used before AssignServices calls until the service cache is implemented.
	LoadServices(ctx context.Context) error
	// AssignServices processes an entity to check if it's belonged to an entity service and modifies it.
	AssignServices(eventEntity *types.Entity, commRegister mongo.CommandsRegister)
	// AssignStateSetting assigns a state setting for a component or a service, returns true if new state setting is assigned.
	AssignStateSetting(ctx context.Context, entity *types.Entity, commRegister mongo.CommandsRegister) (bool, error)
	// UpdateImpactedServicesFromDependencies updates impacted services from dependencies info for connector entity
	UpdateImpactedServicesFromDependencies(ctx context.Context) error
	// RecomputeService recomputes context graph for an entity service
	RecomputeService(ctx context.Context, serviceID string, commRegister mongo.CommandsRegister) (types.Entity, error)
	// ProcessComponentDependencies processes component's dependencies to update component infos or state setting parameters.
	ProcessComponentDependencies(ctx context.Context, component *types.Entity, commRegister mongo.CommandsRegister) ([]string, error)
	// UpdateLastEventDate updates last event date field in the entity document
	UpdateLastEventDate(ctx context.Context, event *types.Event, updateConnectorLastEventDate bool) error
	// InheritComponentFields fills resource with component infos and check if resource is matched by component state setting.
	InheritComponentFields(resource, component *types.Entity, commRegister mongo.CommandsRegister) error
}

func NewManager

func NewManager(
	adapter libentity.Adapter,
	dbClient libmongo.DbClient,
	storage EntityServiceStorage,
	stateSettingService statesetting.Assigner,
	logger zerolog.Logger,
) Manager

type Report

type Report struct {
	// The check flags show if an entity should be included in a second transaction search
	// to check services and state settings.
	CheckResource  bool
	CheckComponent bool
	CheckConnector bool

	// IsNew is used only for event metric
	IsNew bool
}

Jump to

Keyboard shortcuts

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