Documentation ¶
Index ¶
- Constants
- func CallMakeDepGen(service Service) error
- func CallStepByStep(svc Service, states ...Step) error
- func HandleAllServicesNames(_ []byte) interface{}
- func HandleGetEnv(input []byte) interface{}
- func HandleKillServices(input []byte) interface{}
- func HandleLoadAllServices(_ []byte) interface{}
- func HandleLoadServices(input []byte) interface{}
- func HandleReloadEnv(_ []byte) interface{}
- func HandleRestartServices(input []byte) interface{}
- func HandleServicesInfo(input []byte) interface{}
- func HandleStartServices(input []byte) interface{}
- func HandleStopServices(input []byte) interface{}
- func NewHTTPWrapper(wrapped LogicHandler) http.HandlerFunc
- func ServeAllServicesNames() <-chan []string
- func ServeGetEnv(allFlag bool) <-chan []string
- func ServeKillServices(svcNames ...string) <-chan error
- func ServeLoadAllServices() <-chan error
- func ServeLoadServices(svcNames ...string) <-chan error
- func ServeReloadEnv() <-chan error
- func ServeRestartServices(svcNames ...string) <-chan error
- func ServeServicesInfo(allFlag bool) <-chan []ServiceInfo
- func ServeStartServices(svcNames ...string) <-chan error
- func ServeStopServices(svcNames ...string) <-chan error
- func StopServer(w http.ResponseWriter, _ *http.Request)
- func SwitchVersion(service Service) error
- type Action
- type LogicHandler
- type Manager
- type Service
- type ServiceConfig
- type ServiceInfo
- type ServiceRepository
- type Step
Constants ¶
View Source
const ( OK_SIGNAL = "ok" STOP_SIGNAL = "stop" KILL_SIGNAL = "kill" )
View Source
const CANT_FIND_SERVICE = "Can't find service"
View Source
const SERVICES_JSON = "services.json"
Variables ¶
This section is empty.
Functions ¶
func CallMakeDepGen ¶
func CallStepByStep ¶
func HandleAllServicesNames ¶
func HandleAllServicesNames(_ []byte) interface{}
func HandleGetEnv ¶
func HandleGetEnv(input []byte) interface{}
func HandleKillServices ¶
func HandleKillServices(input []byte) interface{}
func HandleLoadAllServices ¶
func HandleLoadAllServices(_ []byte) interface{}
func HandleLoadServices ¶
func HandleLoadServices(input []byte) interface{}
func HandleReloadEnv ¶
func HandleReloadEnv(_ []byte) interface{}
func HandleRestartServices ¶
func HandleRestartServices(input []byte) interface{}
func HandleServicesInfo ¶
func HandleServicesInfo(input []byte) interface{}
func HandleStartServices ¶
func HandleStartServices(input []byte) interface{}
func HandleStopServices ¶
func HandleStopServices(input []byte) interface{}
func NewHTTPWrapper ¶
func NewHTTPWrapper(wrapped LogicHandler) http.HandlerFunc
func ServeAllServicesNames ¶
func ServeAllServicesNames() <-chan []string
func ServeGetEnv ¶
func ServeKillServices ¶
func ServeLoadAllServices ¶
func ServeLoadAllServices() <-chan error
func ServeLoadServices ¶
func ServeReloadEnv ¶
func ServeReloadEnv() <-chan error
func ServeRestartServices ¶
func ServeServicesInfo ¶
func ServeServicesInfo(allFlag bool) <-chan []ServiceInfo
func ServeStartServices ¶
func ServeStopServices ¶
func StopServer ¶
func StopServer(w http.ResponseWriter, _ *http.Request)
func SwitchVersion ¶
Types ¶
type LogicHandler ¶
type LogicHandler func([]byte) interface{}
type Manager ¶
type Manager interface { RegisterService(config *ServiceConfig) error // Add new service to configuration. Start(svcNames ...string) error // Start services with specified names. Stop(svcNames ...string) error // Normal and safely stop services with specified names. Restart(svcNames ...string) error // Restart services with specified names. Kill(svcNames ...string) error // Fast and rude stop services with specified names. Info(allFlag bool) []ServiceInfo // Information about configured services. AllServicesNames() []string // List of all services in configuration. }
type Service ¶
type Service interface { Name() string // Name of service. By this name manager provide operations. Prepare() error // All what should be done first Build() error // All actions that should happened before run. Start() error // Start service. Stop() error // Normal stop service. Kill() error // Fast stop service. Info() *ServiceInfo // General information about current service for `ps` command. Sync() error // Sync service with command line. Should be called after Stop/Kill or before Start to prevent desync. IsRunning() bool // Check, is service is idling or working. }
type ServiceConfig ¶
type ServiceConfig struct { Name string `json:"name"` // Name of service Target string `json:"target"` // Path to Makefile inside Dir/Name/ Args []string `json:"args"` // Command line arguments for service Dir string `json:"dir"` // Full path to directory with service Version string `json:"version"` // Git tag, which can be represented as semantic versioning http://semver.org/ }
type ServiceInfo ¶
type ServiceInfo struct { Name string // Имя сервиса Status string // Состояние сервиса StartupTime time.Time // Timestamp запуска Args []string // Параметры командной строки, передаваемой при запуске сервиса Dir string // Папка, в которой находится сервис Target string // Makefile с шагами install, gen, dep которые вызываются при сборке и смене версий Version string // Запускаемая версия версия, соответствующая http://semver.org/ }
type ServiceRepository ¶
type ServiceRepository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository() *ServiceRepository
func (*ServiceRepository) GetService ¶
func (f *ServiceRepository) GetService(svcName string) (Service, error)
func (*ServiceRepository) Names ¶
func (f *ServiceRepository) Names() []string
func (*ServiceRepository) RegisterService ¶
func (f *ServiceRepository) RegisterService(config *ServiceConfig) error
Click to show internal directories.
Click to hide internal directories.