interfaces

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMock

type ActionMock interface {
	GetResult(name types.ActionName) any
}

ActionMock is an interface for "play" mode. The mock should be registered as an option within the chain.Chain. This mock only returns the prepared result for each action ID.

type ActionRecorder added in v0.2.1

type ActionRecorder interface {
	Add(action model.Action)
}

ActionRecorder records the "play" result of each action, which is used for debugging and testing purposes. An ActionRecorder should be created by the AlertRecorder for each action. The AlertRecorder is registered as an option within the chain.Chain.

type AlertHandler

type AlertHandler func(ctx context.Context, schema types.Schema, data any) ([]*model.Alert, error)

AlertHandler is a function to handle the alert from data source. The handler is registered as an option within the chain.Chain.

type AlertRecorder added in v0.2.1

type AlertRecorder interface {
	NewActionRecorder() ActionRecorder
}

AlertRecorder records the "play" Action results of the chain, which is used for debugging and testing purposes. An AlertRecorder should be created by the ScenarioRecorder for each alert. The ScenarioRecorder is registered as an option within the chain.Chain.

type Database

type Database interface {
	GetAttrs(ctx context.Context, ns types.Namespace) (model.Attributes, error)
	PutAttrs(ctx context.Context, ns types.Namespace, attrs model.Attributes) error
	PutWorkflow(ctx context.Context, workflow model.WorkflowRecord) error
	GetWorkflows(ctx context.Context, offset, limit int) ([]model.WorkflowRecord, error)
	GetWorkflow(ctx context.Context, id types.WorkflowID) (*model.WorkflowRecord, error)
	PutAlert(ctx context.Context, alert model.Alert) error
	GetAlert(ctx context.Context, id types.AlertID) (*model.Alert, error)
	Lock(ctx context.Context, ns types.Namespace, timeout time.Time) error
	Unlock(ctx context.Context, ns types.Namespace) error
	Close() error
}

type Env

type Env func() types.EnvVars

type GenAI added in v0.1.1

type GenAI interface {
	Generate(ctx context.Context, prompts ...string) ([]string, error)
}

type ScenarioRecorder added in v0.2.1

type ScenarioRecorder interface {
	NewAlertRecorder(alert *model.Alert) AlertRecorder
	LogError(err error)
	Flush() error
}

ScenarioRecorder records the "play" result of the alert chain, which is used for debugging and testing purposes. A logger should be created by the LoggerFactory for each scenario. The LoggerFactory is registered as an option within the chain.Chain.

Jump to

Keyboard shortcuts

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