services

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Host service errors
	ErrHostNotFound    = errors.New("host not found")
	ErrInvalidHostData = errors.New("invalid host data")
	ErrDuplicateHost   = errors.New("host already exists")

	// Metric service errors
	ErrInvalidHostID      = errors.New("invalid host ID")
	ErrInvalidCPUUsage    = errors.New("CPU usage must be between 0 and 100")
	ErrInvalidMemoryUsage = errors.New("memory usage must be between 0 and 100")
	ErrInvalidDiskUsage   = errors.New("disk usage must be between 0 and 100")
	ErrNilQueryParams     = errors.New("query parameters cannot be nil")
	ErrMetricNotFound     = errors.New("metric not found")
	ErrInvalidTimeRange   = errors.New("invalid time range")
)

Common service errors

Functions

func ValidateSystemMetric

func ValidateSystemMetric(params *entities.SystemMetric) error

ValidateSystemMetric validates metric data

Types

type HealthService

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

func (*HealthService) CheckHealth

func (service *HealthService) CheckHealth() error

CheckHealth performs basic health checks

func (*HealthService) GetDetailedHealth

func (service *HealthService) GetDetailedHealth() (map[string]interface{}, error)

GetDetailedHealth returns detailed health information

type HealthServiceInterface

type HealthServiceInterface interface {
	CheckHealth() error
	GetDetailedHealth() (map[string]interface{}, error)
}

HealthServiceInterface defines methods for health checks

type HostService

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

func (*HostService) CreateHost

func (service *HostService) CreateHost(host *entities.Host) (int64, error)

CreateHost creates a new host

func (*HostService) DeleteHost

func (service *HostService) DeleteHost(id int64) error

DeleteHost deletes a host by ID

func (*HostService) GetHosts

func (service *HostService) GetHosts(params *entities.HostQueryParams) ([]entities.Host, error)

GetHosts retrieves hosts based on query parameters

func (*HostService) UpdateHost

func (service *HostService) UpdateHost(id int64, host *entities.Host) error

UpdateHost updates an existing host

type HostServiceInterface

type HostServiceInterface interface {
	CreateHost(host *entities.Host) (int64, error)
	GetHosts(params *entities.HostQueryParams) ([]entities.Host, error)
	UpdateHost(id int64, host *entities.Host) error
	DeleteHost(id int64) error
}

HostServiceInterface defines methods for host service operations

type MetricService

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

func (*MetricService) CreateMetric

func (service *MetricService) CreateMetric(metric *entities.SystemMetric) (int64, error)

CreateMetric stores a new metric record

func (*MetricService) GetLatestMetric

func (service *MetricService) GetLatestMetric(hostID *int64) (*entities.SystemMetric, error)

GetLatestMetric retrieves the most recent metric for a specific host or all hosts

func (*MetricService) GetMetrics

func (service *MetricService) GetMetrics(params *entities.MetricQueryParams) ([]entities.SystemMetric, error)

GetMetrics retrieves metrics based on query parameters

type MetricServiceInterface

type MetricServiceInterface interface {
	CreateMetric(metric *entities.SystemMetric) (int64, error)
	GetMetrics(params *entities.MetricQueryParams) ([]entities.SystemMetric, error)
	GetLatestMetric(hostID *int64) (*entities.SystemMetric, error)
}

MetricServiceInterface defines methods for metric service operations

Jump to

Keyboard shortcuts

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