monitor

package
v6.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandTemplate

func ExpandTemplate(input string, vars TemplateVars) string

func NewCommandError

func NewCommandError(commandID, address, message string, cause error) error

func NewConfigError

func NewConfigError(field, message string) error

func NewWatchlistError

func NewWatchlistError(path string, line int, message string) error

Types

type ChainState

type ChainState struct {
	Chain    string
	Monitors []MonitorEntry
	Commands []Command
}

type ChifraExecutor

type ChifraExecutor struct{}

func NewChifraExecutor

func NewChifraExecutor() *ChifraExecutor

func (*ChifraExecutor) Execute

func (e *ChifraExecutor) Execute(ctx context.Context, cmd Command, vars TemplateVars) error

type Command

type Command struct {
	ID        string   `yaml:"id"`
	Command   string   `yaml:"command"`
	Arguments []string `yaml:"arguments"`
	Output    string   `yaml:"output"`
}

func ParseCommands

func ParseCommands(path string) ([]Command, error)

type CommandError

type CommandError struct {
	CommandID string
	Address   string
	Message   string
	Cause     error
}

func (*CommandError) Error

func (e *CommandError) Error() string

func (*CommandError) Unwrap

func (e *CommandError) Unwrap() error

type CommandExecutor

type CommandExecutor interface {
	Execute(ctx context.Context, cmd Command, vars TemplateVars) error
}

func CreateExecutor

func CreateExecutor(commandName string) CommandExecutor

type CommandsFile

type CommandsFile struct {
	Commands []Command `yaml:"commands"`
}

type ConfigError

type ConfigError struct {
	Field   string
	Message string
}

func (*ConfigError) Error

func (e *ConfigError) Error() string

type IterationMetrics

type IterationMetrics struct {
	StartTime       time.Time
	Duration        time.Duration
	BatchesTotal    int
	BatchesFailed   int
	MonitorsTotal   int
	MonitorsSuccess int
	MonitorsFailed  int
}

type JobResult

type JobResult struct {
	Address string
	Success bool
	Error   error
}

type MonitorConfig

type MonitorConfig struct {
	WatchlistDir    string
	CommandsDir     string
	BatchSize       int
	Concurrency     int
	Sleep           int
	MaxBlocksPerRun int
}

func NewMonitorConfig

func NewMonitorConfig() *MonitorConfig

func (*MonitorConfig) Validate

func (c *MonitorConfig) Validate() error

type MonitorEntry

type MonitorEntry struct {
	Address       string
	StartingBlock uint64
}

func DiscoverMonitors

func DiscoverMonitors(chain string) ([]MonitorEntry, error)

func ParseWatchlist

func ParseWatchlist(path string) ([]MonitorEntry, error)

type MonitorJob

type MonitorJob struct {
	Entry    MonitorEntry
	Commands []Command
	Vars     TemplateVars
}

type MonitorService

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

func NewMonitorService

func NewMonitorService(logger *slog.Logger, chains []string, config MonitorConfig) (*MonitorService, error)

func (*MonitorService) Cleanup

func (s *MonitorService) Cleanup()

func (*MonitorService) Initialize

func (s *MonitorService) Initialize() error

func (*MonitorService) IsPaused

func (s *MonitorService) IsPaused() bool

func (*MonitorService) Logger

func (s *MonitorService) Logger() *slog.Logger

func (*MonitorService) Name

func (s *MonitorService) Name() string

func (*MonitorService) Pause

func (s *MonitorService) Pause() bool

func (*MonitorService) Process

func (s *MonitorService) Process(ready chan bool) error

func (*MonitorService) Unpause

func (s *MonitorService) Unpause() bool

type ShellExecutor

type ShellExecutor struct{}

func NewShellExecutor

func NewShellExecutor() *ShellExecutor

func (*ShellExecutor) Execute

func (e *ShellExecutor) Execute(ctx context.Context, cmd Command, vars TemplateVars) error

type TemplateVars

type TemplateVars struct {
	Address    string
	Chain      string
	FirstBlock uint64
	LastBlock  uint64
	BlockCount uint64
}

type WatchlistError

type WatchlistError struct {
	Path    string
	Line    int
	Message string
}

func (*WatchlistError) Error

func (e *WatchlistError) Error() string

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool(concurrency int, executor CommandExecutor) *WorkerPool

func (*WorkerPool) Start

func (wp *WorkerPool) Start()

func (*WorkerPool) Stop

func (wp *WorkerPool) Stop()

func (*WorkerPool) Submit

func (wp *WorkerPool) Submit(job MonitorJob)

func (*WorkerPool) Wait

func (wp *WorkerPool) Wait() []JobResult

Jump to

Keyboard shortcuts

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