entityservice

package
v0.0.0-...-3b5b65c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	GetValid(ctx context.Context) ([]EntityService, error)

	// UpdateBulk bulk update
	UpdateBulk(ctx context.Context, writeModels []mongodriver.WriteModel) error
}

Adapter is an interface that provides methods for database queries regarding services and their dependencies.

func NewAdapter

func NewAdapter(client mongo.DbClient) Adapter

type ChangeEntityMessage

type ChangeEntityMessage struct {
	ID        string
	Name      string
	Component string
	// IsToggled is true if entity is disabled or enabled.
	IsToggled  bool
	EntityType string
	// IsPatternChanged defines should service's context graph and state be recomputed.
	IsServicePatternChanged bool
	// Resources are used only when component entity is toggled to toggle dependent resources
	Resources []string
}

type EntityService

type EntityService struct {
	types.Entity   `bson:",inline"`
	OutputTemplate string `bson:"output_template" json:"output_template"`

	savedpattern.EntityPatternFields `bson:",inline"`
}

func (*EntityService) GetMongoQueries

func (s *EntityService) GetMongoQueries() (bson.M, bson.M, error)

type EventPublisher

type EventPublisher interface {
	Publish(ctx context.Context, ch <-chan ChangeEntityMessage)
}

EventPublisher is used to send event to engines' event flow to notify about entity changes.

func NewEventPublisher

func NewEventPublisher(
	publisher libamqp.Publisher,
	encoder encoding.Encoder,
	contentType string,
	exchange, routingKey string,
	connector string,
	logger zerolog.Logger,
) EventPublisher

type IdleSinceService

type IdleSinceService interface {
	RecomputeIdleSince(parentCtx context.Context) error
}

func NewService

func NewService(
	adapter Adapter,
	entityAdapter entity.Adapter,
	logger zerolog.Logger,
) IdleSinceService

type ServicesIdleSinceMap

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

func NewServicesIdleSinceMap

func NewServicesIdleSinceMap() ServicesIdleSinceMap

func (*ServicesIdleSinceMap) Mark

func (m *ServicesIdleSinceMap) Mark(id string, newIdleSince int64) bool

Jump to

Keyboard shortcuts

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