Documentation
¶
Index ¶
- func ConvertAirToml(inputPath string) error
- type AirConfig
- type BuildConfig
- type ColorConfig
- type Config
- type GatewayService
- func (gs *GatewayService) Communicate(stream pb.DevloopGatewayService_CommunicateServer) error
- func (gs *GatewayService) GetConfig(ctx context.Context, req *pb.GetConfigRequest) (*pb.GetConfigResponse, error)
- func (gs *GatewayService) GetHistoricalLogsClient(req *pb.GetHistoricalLogsClientRequest, ...) error
- func (gs *GatewayService) GetRuleStatus(ctx context.Context, req *pb.GetRuleStatusRequest) (*pb.GetRuleStatusResponse, error)
- func (gs *GatewayService) ListWatchedPaths(ctx context.Context, req *pb.ListWatchedPathsRequest) (*pb.ListWatchedPathsResponse, error)
- func (gs *GatewayService) ReadFileContent(ctx context.Context, req *pb.ReadFileContentRequest) (*pb.ReadFileContentResponse, error)
- func (gs *GatewayService) Start(grpcPort int, httpPort int) error
- func (gs *GatewayService) Stop()
- func (gs *GatewayService) StreamLogsClient(req *pb.StreamLogsClientRequest, ...) error
- func (gs *GatewayService) TriggerRuleClient(ctx context.Context, req *pb.TriggerRuleClientRequest) (*pb.TriggerRuleClientResponse, error)
- type LogConfig
- type Matcher
- type MiscConfig
- type Orchestrator
- type ProjectInstance
- type Rule
- type RuleStatus
- type Settings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAirToml ¶ added in v0.0.30
Types ¶
type AirConfig ¶ added in v0.0.30
type AirConfig struct {
Root string `toml:"root"`
TmpDir string `toml:"tmp_dir"`
Build BuildConfig `toml:"build"`
Log LogConfig `toml:"log"`
Misc MiscConfig `toml:"misc"`
Color ColorConfig `toml:"color"`
}
AirConfig represents the structure of a .air.toml file.
type BuildConfig ¶ added in v0.0.30
type BuildConfig struct {
Cmd string `toml:"cmd"`
Bin string `toml:"bin"`
PreCmd []string `toml:"pre_cmd"`
PostCmd []string `toml:"post_cmd"`
IncludeExt []string `toml:"include_ext"`
ExcludeDir []string `toml:"exclude_dir"`
ExcludeFile []string `toml:"exclude_file"`
IncludeDir []string `toml:"include_dir"`
ExcludeRegex []string `toml:"exclude_regex"`
StopOnError bool `toml:"stop_on_error"`
Delay int `toml:"delay"`
}
type ColorConfig ¶ added in v0.0.30
type GatewayService ¶
type GatewayService struct {
pb.UnimplementedDevloopGatewayServiceServer // Embed for forward compatibility
pb.UnimplementedGatewayClientServiceServer // Embed for forward compatibility
// contains filtered or unexported fields
}
GatewayService manages registered devloop instances and proxies requests.
func NewGatewayService ¶
func NewGatewayService(orchestrator Orchestrator) *GatewayService
NewGatewayService creates a new GatewayService instance.
func (*GatewayService) Communicate ¶
func (gs *GatewayService) Communicate(stream pb.DevloopGatewayService_CommunicateServer) error
Communicate implements pb.DevloopGatewayServiceServer.
func (*GatewayService) GetConfig ¶
func (gs *GatewayService) GetConfig(ctx context.Context, req *pb.GetConfigRequest) (*pb.GetConfigResponse, error)
GetConfig implements pb.GatewayClientServiceServer.
func (*GatewayService) GetHistoricalLogsClient ¶
func (gs *GatewayService) GetHistoricalLogsClient(req *pb.GetHistoricalLogsClientRequest, stream pb.GatewayClientService_GetHistoricalLogsClientServer) error
GetHistoricalLogsClient implements pb.GatewayClientServiceServer.
func (*GatewayService) GetRuleStatus ¶
func (gs *GatewayService) GetRuleStatus(ctx context.Context, req *pb.GetRuleStatusRequest) (*pb.GetRuleStatusResponse, error)
GetRuleStatus implements pb.GatewayClientServiceServer.
func (*GatewayService) ListWatchedPaths ¶
func (gs *GatewayService) ListWatchedPaths(ctx context.Context, req *pb.ListWatchedPathsRequest) (*pb.ListWatchedPathsResponse, error)
ListWatchedPaths implements pb.GatewayClientServiceServer.
func (*GatewayService) ReadFileContent ¶
func (gs *GatewayService) ReadFileContent(ctx context.Context, req *pb.ReadFileContentRequest) (*pb.ReadFileContentResponse, error)
ReadFileContent implements pb.GatewayClientServiceServer.
func (*GatewayService) Stop ¶
func (gs *GatewayService) Stop()
func (*GatewayService) StreamLogsClient ¶
func (gs *GatewayService) StreamLogsClient(req *pb.StreamLogsClientRequest, stream pb.GatewayClientService_StreamLogsClientServer) error
StreamLogsClient implements pb.GatewayClientServiceServer.
func (*GatewayService) TriggerRuleClient ¶
func (gs *GatewayService) TriggerRuleClient(ctx context.Context, req *pb.TriggerRuleClientRequest) (*pb.TriggerRuleClientResponse, error)
TriggerRuleClient implements pb.GatewayClientServiceServer.
type Matcher ¶
type Matcher struct {
Action string `yaml:"action"` // Should be "include" or "exclude"
Patterns []string `yaml:"patterns"`
}
Matcher defines a single include or exclude directive using glob patterns.
type MiscConfig ¶ added in v0.0.30
type MiscConfig struct {
CleanOnExit bool `toml:"clean_on_exit"`
}
type Orchestrator ¶
type Orchestrator interface {
GetConfig() *Config
GetRuleStatus(ruleName string) (*RuleStatus, bool)
TriggerRule(ruleName string) error
GetWatchedPaths() []string
ReadFileContent(path string) ([]byte, error)
StreamLogs(ruleName string, filter string, stream pb.GatewayClientService_StreamLogsClientServer) error
}
Orchestrator is an interface that defines the methods that the gateway service needs to interact with the orchestrator.
type ProjectInstance ¶
type ProjectInstance struct {
ProjectID string `json:"project_id"`
ProjectRoot string `json:"project_root"`
// contains filtered or unexported fields
}
ProjectInstance represents a registered devloop instance.
type Rule ¶
type Rule struct {
Name string `yaml:"name"`
Prefix string `yaml:"prefix,omitempty"`
Commands []string `yaml:"commands"`
Watch []*Matcher `yaml:"watch"`
Env map[string]string `yaml:"env,omitempty"`
WorkDir string `yaml:"workdir,omitempty"`
RunOnInit *bool `yaml:"run_on_init,omitempty"`
DebounceDelay *time.Duration `yaml:"debounce_delay,omitempty"`
Verbose *bool `yaml:"verbose,omitempty"`
Color string `yaml:"color,omitempty"`
DefaultAction string `yaml:"default_action,omitempty"` // "include" or "exclude"
}
Rule defines a single watch-and-run rule.
func (*Rule) GetColor ¶ added in v0.0.30
GetColor returns the rule color (implements ColorRule interface)
func (*Rule) GetName ¶ added in v0.0.30
GetName returns the rule name (implements Nameable interface for color generation)
type RuleStatus ¶
type RuleStatus struct {
ProjectID string `json:"project_id"`
RuleName string `json:"rule_name"`
IsRunning bool `json:"is_running"`
StartTime time.Time `json:"start_time,omitempty"`
LastBuildTime time.Time `json:"last_build_time,omitempty"`
LastBuildStatus string `json:"last_build_status,omitempty"` // e.g., "SUCCESS", "FAILED", "IDLE"
}
RuleStatus defines the status of a rule.
type Settings ¶
type Settings struct {
ProjectID string `yaml:"project_id,omitempty"`
PrefixLogs bool `yaml:"prefix_logs"`
PrefixMaxLength int `yaml:"prefix_max_length"`
DefaultDebounceDelay *time.Duration `yaml:"default_debounce_delay,omitempty"`
Verbose bool `yaml:"verbose,omitempty"`
ColorLogs bool `yaml:"color_logs,omitempty"`
ColorScheme string `yaml:"color_scheme,omitempty"`
CustomColors map[string]string `yaml:"custom_colors,omitempty"`
DefaultWatchAction string `yaml:"default_watch_action,omitempty"` // "include" or "exclude"
}
Settings defines global settings for devloop.
func (*Settings) GetColorLogs ¶ added in v0.0.30
GetColorLogs returns whether color logs are enabled (implements ColorSettings interface)
func (*Settings) GetColorScheme ¶ added in v0.0.30
GetColorScheme returns the color scheme (implements ColorSettings interface)
func (*Settings) GetCustomColors ¶ added in v0.0.30
GetCustomColors returns the custom color mappings (implements ColorSettings interface)