inforo

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 13 Imported by: 0

README

Inforo Core Module

The core module of the Inforo system providing essential functionality for component management, task execution, and monitoring.

Overview

The core package is the central module that orchestrates all major subsystems:

  • Component management
  • Task execution
  • Monitoring
  • Planning

Installation

go get github.com/laplasd/inforo

Core Structure

The main Core struct contains registries for different subsystems:

type Core struct {
    logger             *logrus.Logger
    Components         api.ComponentRegistry
    Controllers        api.ControllerRegistry
    Monitorings        api.MonitoringRegistry
    MonitorControllers api.MonitoringControllerRegistry
    Tasks              api.TaskRegistry
    Plans              api.PlanRegistry
}

Initialization

Default Core
core := NewDefaultCore()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNullLogger

func NewNullLogger() *logrus.Logger

NewNullLogger creates a logger that discards all log output. Useful for testing or when logging is not required.

Returns: *logrus.Logger - configured logger with output discarded

func NewPlanRegistry

func NewPlanRegistry(opts PlanRegistryOptions) (api.PlanRegistry, error)

func NewTaskRegistry

func NewTaskRegistry(opts TaskRegistryOptions) (api.TaskRegistry, error)

Types

type ComponentRegistry

type ComponentRegistry struct {
	Controllers api.ControllerRegistry

	*Events
	*StatusManager
	// contains filtered or unexported fields
}

func (*ComponentRegistry) Delete

func (cr *ComponentRegistry) Delete(id string) error

func (*ComponentRegistry) Disable

func (cr *ComponentRegistry) Disable(id string) error

func (*ComponentRegistry) Enable

func (cr *ComponentRegistry) Enable(id string) error

func (*ComponentRegistry) Get

func (cr *ComponentRegistry) Get(id string) (*model.Component, error)

func (*ComponentRegistry) GetBy

func (cr *ComponentRegistry) GetBy(key string, value string) ([]*model.Component, error)

func (*ComponentRegistry) List

func (cr *ComponentRegistry) List() ([]*model.Component, error)

func (*ComponentRegistry) Register

func (cr *ComponentRegistry) Register(comp model.Component) (*model.Component, error)

func (*ComponentRegistry) UpVersion

func (cr *ComponentRegistry) UpVersion(componentID string, version string)

func (*ComponentRegistry) Update

func (cr *ComponentRegistry) Update(id string, updatedComp *model.Component) error

type ComponentRegistryOptions

type ComponentRegistryOptions struct {
	Logger        *logrus.Logger
	Controllers   api.ControllerRegistry
	StatusManager *StatusManager
	EventManager  *Events
}

type ControllerRegistry

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

func (*ControllerRegistry) Delete

func (cr *ControllerRegistry) Delete(c string) error

func (*ControllerRegistry) Get

func (cr *ControllerRegistry) Get(componentType string) (api.Controller, error)

func (*ControllerRegistry) List

func (cr *ControllerRegistry) List() ([]api.Controller, error)

func (*ControllerRegistry) ListType

func (cr *ControllerRegistry) ListType() ([]string, error)

func (*ControllerRegistry) Register

func (cr *ControllerRegistry) Register(controllerType string, controller api.Controller) error

func (*ControllerRegistry) Update

func (cr *ControllerRegistry) Update(c string, comp api.Controller) error

type ControllerRegistryOptions

type ControllerRegistryOptions struct {
	Logger *logrus.Logger
}

type Core

type Core struct {
	Logger             *logrus.Logger                   // Central logger instance
	Components         api.ComponentRegistry            // Registry for system components
	Controllers        api.ControllerRegistry           // Registry for component controllers
	Monitorings        api.MonitoringRegistry           // Registry for monitoring systems
	MonitorControllers api.MonitoringControllerRegistry // Registry for monitoring controllers
	Tasks              api.TaskRegistry                 // Registry for task management
	Plans              api.PlanRegistry                 // Registry for execution plans
}

Core represents the central orchestrator that manages all system operations. It contains registries for different system aspects and coordinates their interactions.

func NewCore

func NewCore(opt CoreOptions) *Core

NewCore creates a new Core instance with custom configurations. Any nil options will be replaced with default implementations.

Parameters:

  • opt: CoreOptions containing custom configurations

Returns: *Core - initialized core instance with merged custom and default configurations

func NewDefaultCore

func NewDefaultCore() *Core

NewDefaultCore creates a new Core instance with default implementations for all registries and a null logger.

Returns: *Core - initialized core instance with default configurations

type CoreOptions

type CoreOptions struct {
	Logger             *logrus.Logger                   `json:"Logger"`             // Custom logger instance
	Components         api.ComponentRegistry            `json:"Components"`         // Custom component registry
	Controllers        api.ControllerRegistry           `json:"Controllers"`        // Custom controller registry
	Monitorings        api.MonitoringRegistry           `json:"Monitorings"`        // Custom monitoring registry
	MonitorControllers api.MonitoringControllerRegistry `json:"MonitorControllers"` // Custom monitoring controller registry
	Tasks              api.TaskRegistry                 `json:"Tasks"`              // Custom task registry
	Plans              api.PlanRegistry                 `json:"Plans"`              // Custom plan registry
}

CoreOptions provides configuration options for initializing a Core instance. All fields are optional - nil values will be replaced with default implementations.

func DefaultOpts added in v0.1.5

func DefaultOpts(opt CoreOptions) CoreOptions

DefaultOpts ensures all required options are set with default values where no custom implementation is provided.

Parameters:

  • opt: CoreOptions containing partial or complete configurations

Returns: CoreOptions - complete options with defaults filled in

type Events

type Events struct {
}

func (*Events) AddEvent

func (e *Events) AddEvent(events *model.EventHistory, message string)

type MonitoringControllerRegistry

type MonitoringControllerRegistry struct {
	Logger *logrus.Logger
	// contains filtered or unexported fields
}

func (*MonitoringControllerRegistry) Delete

func (mcr *MonitoringControllerRegistry) Delete(c string) error

func (*MonitoringControllerRegistry) Get

func (*MonitoringControllerRegistry) List

func (*MonitoringControllerRegistry) Register

func (mcr *MonitoringControllerRegistry) Register(controllerType string, controller api.MonitoringController) error

func (*MonitoringControllerRegistry) Update

type MonitoringControllerRegistryOptions

type MonitoringControllerRegistryOptions struct {
	Logger *logrus.Logger
}

type MonitoringRegistry

type MonitoringRegistry struct {
	*StatusManager
	*Events
	// contains filtered or unexported fields
}

func (*MonitoringRegistry) CheckConfig added in v0.3.0

func (mr *MonitoringRegistry) CheckConfig(compType string, compConfig map[string]string) error

func (*MonitoringRegistry) Delete

func (mr *MonitoringRegistry) Delete(id string) error

func (*MonitoringRegistry) Get

func (*MonitoringRegistry) List

func (mr *MonitoringRegistry) List() ([]*model.Monitoring, error)

func (*MonitoringRegistry) Register

func (mr *MonitoringRegistry) Register(tp string, m *model.Monitoring) (*model.Monitoring, error)

func (*MonitoringRegistry) Update

func (mr *MonitoringRegistry) Update(id string, updated *model.Monitoring) error

type MonitoringRegistryOptions

type MonitoringRegistryOptions struct {
	Logger        *logrus.Logger
	Controllers   api.MonitoringControllerRegistry
	StatusManager *StatusManager
	EventManager  *Events
}

type PlanRegistry

type PlanRegistry struct {
	Components api.ComponentRegistry
	Tasks      api.TaskRegistry
	*StatusManager
	*Events
	// contains filtered or unexported fields
}

func (*PlanRegistry) Delete

func (pr *PlanRegistry) Delete(id string) error

DeletePlan removes a plan from storage.

func (*PlanRegistry) Get

func (pr *PlanRegistry) Get(id string) (*model.Plan, error)

GetPlan retrieves a plan by ID.

func (*PlanRegistry) List

func (pr *PlanRegistry) List() ([]*model.Plan, error)

ListPlans returns all plans.

func (*PlanRegistry) Pause

func (pr *PlanRegistry) Pause(planID string) error

Pause temporarily halts execution of a running plan

func (*PlanRegistry) Register

func (pr *PlanRegistry) Register(tasks []*model.Task) (*model.Plan, error)

func (*PlanRegistry) Run

func (pr *PlanRegistry) Run(planID string, executionID string) (string, error)

func (*PlanRegistry) RunAsync

func (pr *PlanRegistry) RunAsync(planID string, executionID string) (string, error)

func (*PlanRegistry) Status

func (pr *PlanRegistry) Status(planID string) (model.Status, error)

Status returns the current status of a plan

func (*PlanRegistry) Stop

func (pr *PlanRegistry) Stop(planID string) error

Stop terminates execution of a running plan

func (*PlanRegistry) Update

func (pr *PlanRegistry) Update(id string, updated model.Plan) error

UpdatePlan updates tasks in a plan (e.g. reordering, changing metadata).

type PlanRegistryOptions

type PlanRegistryOptions struct {
	Logger        *logrus.Logger
	Components    api.ComponentRegistry
	Tasks         api.TaskRegistry
	StatusManager *StatusManager
	EventManager  *Events
}

type StatusManager

type StatusManager struct {
}

func (*StatusManager) NewStatus

func (s *StatusManager) NewStatus(status model.Status) *model.StatusHistory

func (*StatusManager) NextStatus

func (s *StatusManager) NextStatus(status model.Status, history *model.StatusHistory) *model.StatusHistory

type TaskRegistry

type TaskRegistry struct {
	Components         api.ComponentRegistry
	Controllers        api.ControllerRegistry
	Monitoring         api.MonitoringRegistry
	MonitorControllers api.MonitoringControllerRegistry
	*StatusManager
	*Events
	MU *sync.RWMutex
	// contains filtered or unexported fields
}

func (*TaskRegistry) Delete

func (ts *TaskRegistry) Delete(id string) error

func (*TaskRegistry) Fork

func (ts *TaskRegistry) Fork(taskID string, executionID string) (string, error)

func (*TaskRegistry) ForkAsync

func (ts *TaskRegistry) ForkAsync(taskID string, executionID string) (string, error)

func (*TaskRegistry) Get

func (ts *TaskRegistry) Get(taskID string) (*model.Task, error)

func (*TaskRegistry) IsValidCheck

func (ts *TaskRegistry) IsValidCheck(checks []*model.Check) error

func (*TaskRegistry) List

func (ts *TaskRegistry) List() ([]*model.Task, error)

func (*TaskRegistry) Pause

func (ts *TaskRegistry) Pause(taskID string) error

func (*TaskRegistry) Register

func (ts *TaskRegistry) Register(task *model.Task) (*model.Task, error)

func (*TaskRegistry) RollBack

func (ts *TaskRegistry) RollBack(taskID string, executionID string) (string, error)

func (*TaskRegistry) RollBackAsync

func (ts *TaskRegistry) RollBackAsync(taskID string, executionID string) (string, error)

func (*TaskRegistry) Status

func (ts *TaskRegistry) Status(taskID string) (string, error)

func (*TaskRegistry) Stop

func (ts *TaskRegistry) Stop(taskID string) error

func (*TaskRegistry) Update

func (ts *TaskRegistry) Update(id string, updated *model.Task) error

func (*TaskRegistry) UpdateTaskStatus

func (ts *TaskRegistry) UpdateTaskStatus(task *model.Task, status model.Status) error

func (*TaskRegistry) Validate

func (ts *TaskRegistry) Validate(task *model.Task) error

type TaskRegistryOptions

type TaskRegistryOptions struct {
	Logger             *logrus.Logger
	Components         api.ComponentRegistry
	Controllers        api.ControllerRegistry
	Monitoring         api.MonitoringRegistry
	MonitorControllers api.MonitoringControllerRegistry
	StatusManager      *StatusManager
	EventManager       *Events
}

Directories

Path Synopsis
basic command
Базовое использование inforo Core
Базовое использование inforo Core

Jump to

Keyboard shortcuts

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