utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateDirName  = ".entropy"
	StateFileName = "state.json"
	LogFileName   = "engine.log"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChaosLogger

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

func NewChaosLogger

func NewChaosLogger(logFilePath, format string) (*ChaosLogger, error)

func (*ChaosLogger) Close

func (l *ChaosLogger) Close()

func (*ChaosLogger) LogCooldownSkip

func (l *ChaosLogger) LogCooldownSkip(remaining float64)

func (*ChaosLogger) LogError

func (l *ChaosLogger) LogError(message string)

func (*ChaosLogger) LogInjection

func (l *ChaosLogger) LogInjection(event InjectionEvent)

func (*ChaosLogger) LogMaxDownSkip

func (l *ChaosLogger) LogMaxDownSkip(downContainers []string)

func (*ChaosLogger) LogStart

func (l *ChaosLogger) LogStart(cfg *config.ChaosConfig)

func (*ChaosLogger) LogStop

func (l *ChaosLogger) LogStop(cycleCount, injectionCount int)

type EngineState

type EngineState struct {
	PID               int           `json:"pid"`
	StartedAt         time.Time     `json:"started_at"`
	ConfigPath        string        `json:"config_path"`
	DryRun            bool          `json:"dry_run"`
	CycleCount        int           `json:"cycle_count"`
	DownContainers    []string      `json:"down_containers"`
	CooldownRemaining float64       `json:"cooldown_remaining"`
	CooldownTotal     int           `json:"cooldown_total"`
	LastEvent         *EventRecord  `json:"last_event"`
	History           []EventRecord `json:"history"`
}

type EventRecord

type EventRecord struct {
	Timestamp    time.Time `json:"timestamp"`
	Action       string    `json:"action"`
	Target       string    `json:"target"`
	DryRun       bool      `json:"dry_run"`
	ResultStatus string    `json:"result_status"`
	Error        string    `json:"error"`
}

type InjectionEvent

type InjectionEvent struct {
	Action       string
	Target       string
	Success      bool
	ResultStatus string
	Error        string
	DryRun       bool
}

type StateManager

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

func NewStateManager

func NewStateManager(cwd string) *StateManager

func (*StateManager) Clear

func (s *StateManager) Clear() error

func (*StateManager) EnsureDir

func (s *StateManager) EnsureDir() error

func (*StateManager) IsAlive

func (s *StateManager) IsAlive(pid int) bool

func (*StateManager) LogFile

func (s *StateManager) LogFile() string

func (*StateManager) Read

func (s *StateManager) Read() (*EngineState, error)

func (*StateManager) RunningPID

func (s *StateManager) RunningPID() *int

func (*StateManager) StateFile

func (s *StateManager) StateFile() string

func (*StateManager) Write

func (s *StateManager) Write(data *EngineState) error

Jump to

Keyboard shortcuts

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