Documentation
¶
Index ¶
- func ExpandTemplate(input string, vars TemplateVars) string
- func NewCommandError(commandID, address, message string, cause error) error
- func NewConfigError(field, message string) error
- func NewWatchlistError(path string, line int, message string) error
- type ChainState
- type ChifraExecutor
- type Command
- type CommandError
- type CommandExecutor
- type CommandsFile
- type ConfigError
- type IterationMetrics
- type JobResult
- type MonitorConfig
- type MonitorEntry
- type MonitorJob
- type MonitorService
- func (s *MonitorService) Cleanup()
- func (s *MonitorService) Initialize() error
- func (s *MonitorService) IsPaused() bool
- func (s *MonitorService) Logger() *slog.Logger
- func (s *MonitorService) Name() string
- func (s *MonitorService) Pause() bool
- func (s *MonitorService) Process(ready chan bool) error
- func (s *MonitorService) Unpause() bool
- type ShellExecutor
- type TemplateVars
- type WatchlistError
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandTemplate ¶
func ExpandTemplate(input string, vars TemplateVars) string
func NewCommandError ¶
func NewConfigError ¶
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 ¶
type CommandError ¶
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 ¶
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
type IterationMetrics ¶
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 ¶
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 WatchlistError ¶
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
Click to show internal directories.
Click to hide internal directories.