app

package
v0.0.0-...-ea7e623 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer interface {
	FindOutliers(*domain.Dataset, *domain.DetectionJob) ([]*domain.Anomaly, error)
}

Analyzer provides outlier detection service

type App

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

App combines services and holds business logic

func NewApp

func NewApp(
	cfg configs.Config,
	logger *logger.Logger,
	repo Repository,
	dataset DatasetFetcher,
	notification Notifier,
	analyzer Analyzer,
) *App

func (*App) CreateAnomaly

func (a *App) CreateAnomaly(anomaly *domain.Anomaly) error

func (*App) CreateDetectionJob

func (a *App) CreateDetectionJob(job *domain.DetectionJob) (*domain.DetectionJob, error)

func (*App) DeleteDetectionJob

func (a *App) DeleteDetectionJob(jobID int) error

func (*App) GetPendingJobs

func (a *App) GetPendingJobs() ([]*domain.DetectionJob, error)

func (*App) ListAnomalies

func (a *App) ListAnomalies(args *domain.FilterAnomaliesArgs) ([]*domain.Anomaly, error)

func (*App) ListDetectionJobs

func (a *App) ListDetectionJobs(args *domain.FilterDetectionJobsArgs) ([]*domain.DetectionJob, error)

func (*App) Notify

func (a *App) Notify() error

func (*App) RunBackgroundJob

func (a *App) RunBackgroundJob(job domain.DetectionJob)

func (*App) RunDetectionJob

func (a *App) RunDetectionJob(job *domain.DetectionJob) ([]*domain.Anomaly, *domain.DetectionJobInstance, error)

func (*App) ScheduleJobs

func (a *App) ScheduleJobs() error

func (*App) ScheduleNotifications

func (a *App) ScheduleNotifications() error

func (*App) SetAnomalyStatus

func (a *App) SetAnomalyStatus(anomalyID int, processed bool) error

type DatasetFetcher

type DatasetFetcher interface {
	Fetch(*domain.DetectionJob) (*domain.Dataset, error)
}

DatasetFetcher fetches dataset for a given job

type Notifier

type Notifier interface {
	Notify(*domain.Notification) error
}

Notifier provides notification service

type Repository

type Repository interface {
	// anomalies
	CreateAnomaly(*domain.Anomaly) (*domain.Anomaly, error)
	FilterAnomalies(*domain.FilterAnomaliesArgs) ([]*domain.Anomaly, error)
	SetAnomalyStatus(anomalyID int, processed bool) error

	// detection jobs
	CreateDetectionJob(*domain.DetectionJob) (*domain.DetectionJob, error)
	DeleteDetectionJobByID(int) error
	FilterDetectionJobs(*domain.FilterDetectionJobsArgs) ([]*domain.DetectionJob, error)
	CreateDetectionInstanceJob(*domain.DetectionJobInstance) (*domain.DetectionJobInstance, error)
}

Repository stores data

Jump to

Keyboard shortcuts

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