Documentation
¶
Index ¶
- func LoadConfig(configPath string) (*gateway.Config, error)
- type Orchestrator
- type OrchestratorV2
- func (o *OrchestratorV2) GetConfig() *gateway.Config
- func (o *OrchestratorV2) GetRuleStatus(ruleName string) (*gateway.RuleStatus, bool)
- func (o *OrchestratorV2) GetWatchedPaths() []string
- func (o *OrchestratorV2) ProjectRoot() string
- func (o *OrchestratorV2) ReadFileContent(path string) ([]byte, error)
- func (o *OrchestratorV2) SetGlobalDebounceDelay(duration time.Duration)
- func (o *OrchestratorV2) SetRuleDebounceDelay(ruleName string, duration time.Duration) error
- func (o *OrchestratorV2) SetRuleVerbose(ruleName string, verbose bool) error
- func (o *OrchestratorV2) SetVerbose(verbose bool)
- func (o *OrchestratorV2) Start() error
- func (o *OrchestratorV2) Stop() error
- func (o *OrchestratorV2) StreamLogs(ruleName string, filter string, ...) error
- func (o *OrchestratorV2) TriggerRule(ruleName string) error
- type PrefixWriter
- type RuleRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Orchestrator ¶
type Orchestrator interface {
Start() error
Stop() error
GetConfig() *gateway.Config
TriggerRule(ruleName string) error
GetRuleStatus(ruleName string) (*gateway.RuleStatus, bool)
GetWatchedPaths() []string
ReadFileContent(path string) ([]byte, error)
SetGlobalDebounceDelay(duration time.Duration)
SetVerbose(verbose bool)
}
Orchestrator interface defines the common methods for orchestrator implementations
func NewOrchestratorForTesting ¶
func NewOrchestratorForTesting(configPath, gatewayAddr string) (Orchestrator, error)
NewOrchestratorForTesting creates a new V2 orchestrator for testing
type OrchestratorV2 ¶
type OrchestratorV2 struct {
ConfigPath string
Config *gateway.Config
Verbose bool
Watcher *fsnotify.Watcher
LogManager *utils.LogManager
ColorManager *utils.ColorManager
// contains filtered or unexported fields
}
OrchestratorV2 manages file watching and delegates execution to RuleRunners
func NewOrchestratorV2 ¶
func NewOrchestratorV2(configPath string, gatewayAddr string) (*OrchestratorV2, error)
NewOrchestratorV2 creates a new orchestrator using RuleRunners
func (*OrchestratorV2) GetConfig ¶
func (o *OrchestratorV2) GetConfig() *gateway.Config
GetConfig returns the orchestrator's configuration.
func (*OrchestratorV2) GetRuleStatus ¶
func (o *OrchestratorV2) GetRuleStatus(ruleName string) (*gateway.RuleStatus, bool)
GetRuleStatus returns the status of a specific rule
func (*OrchestratorV2) GetWatchedPaths ¶
func (o *OrchestratorV2) GetWatchedPaths() []string
GetWatchedPaths returns a unique list of all paths being watched by any rule
func (*OrchestratorV2) ProjectRoot ¶
func (o *OrchestratorV2) ProjectRoot() string
ProjectRoot returns the project root directory
func (*OrchestratorV2) ReadFileContent ¶
func (o *OrchestratorV2) ReadFileContent(path string) ([]byte, error)
ReadFileContent reads and returns the content of a specified file
func (*OrchestratorV2) SetGlobalDebounceDelay ¶
func (o *OrchestratorV2) SetGlobalDebounceDelay(duration time.Duration)
SetGlobalDebounceDelay sets the default debounce delay for all rules
func (*OrchestratorV2) SetRuleDebounceDelay ¶
func (o *OrchestratorV2) SetRuleDebounceDelay(ruleName string, duration time.Duration) error
SetRuleDebounceDelay sets the debounce delay for a specific rule
func (*OrchestratorV2) SetRuleVerbose ¶
func (o *OrchestratorV2) SetRuleVerbose(ruleName string, verbose bool) error
SetRuleVerbose sets the verbose flag for a specific rule
func (*OrchestratorV2) SetVerbose ¶
func (o *OrchestratorV2) SetVerbose(verbose bool)
SetVerbose sets the global verbose flag
func (*OrchestratorV2) Start ¶
func (o *OrchestratorV2) Start() error
Start begins file watching and initializes all RuleRunners
func (*OrchestratorV2) Stop ¶
func (o *OrchestratorV2) Stop() error
Stop gracefully shuts down the orchestrator
func (*OrchestratorV2) StreamLogs ¶
func (o *OrchestratorV2) StreamLogs(ruleName string, filter string, stream pb.GatewayClientService_StreamLogsClientServer) error
StreamLogs streams the logs for a given rule to the provided gRPC stream
func (*OrchestratorV2) TriggerRule ¶
func (o *OrchestratorV2) TriggerRule(ruleName string) error
TriggerRule manually triggers the execution of a specific rule
type PrefixWriter ¶
type PrefixWriter struct {
// contains filtered or unexported fields
}
PrefixWriter is an io.Writer that adds a prefix to each line of output.
type RuleRunner ¶
type RuleRunner interface {
// Lifecycle management
Start() error // Start monitoring and execution
Stop() error // Stop all processes and cleanup
Restart() error // Restart all processes
Execute() error // Execute the rule's commands
// Status and state
IsRunning() bool
GetStatus() *gateway.RuleStatus
GetRule() gateway.Rule
// Debouncing
TriggerDebounced() // Called when a file change is detected
// Process management
TerminateProcesses() error
// Configuration
SetDebounceDelay(duration time.Duration)
SetVerbose(verbose bool)
}
RuleRunner manages the execution lifecycle of a single rule
func NewRuleRunner ¶
func NewRuleRunner(rule gateway.Rule, orchestrator *OrchestratorV2) RuleRunner
NewRuleRunner creates a new RuleRunner for the given rule