Documentation ¶
Index ¶
- Constants
- func Check(cmdCtx *cmdcontext.CmdCtx, run *InstanceCtx) error
- func ExtractActiveAppNames(instances []InstanceCtx) []string
- func ExtractActiveInstanceNames(instances []InstanceCtx) []string
- func ExtractAppNames(instances []InstanceCtx) []string
- func ExtractInactiveAppNames(instances []InstanceCtx) []string
- func ExtractInactiveInstanceNames(instances []InstanceCtx) []string
- func ExtractInstanceNames(instances []InstanceCtx) []string
- func FillCtx(cliOpts *config.CliOpts, cmdCtx *cmdcontext.CmdCtx, runningCtx *RunningCtx, ...) error
- func GetAppInstanceName(instance InstanceCtx) string
- func IsAbleToStartInstances(instances []InstanceCtx, cmdCtx *cmdcontext.CmdCtx) (bool, string)
- func IsInstanceActive(instance *InstanceCtx) bool
- func IsInstanceInactive(instance *InstanceCtx) bool
- func Logrotate(run *InstanceCtx) (string, error)
- func NewArtifactsPathBuilder(baseDir, appName string) *artifactsPathBuilder
- func Run(runOpts *RunOpts, scriptPath string) error
- func Start(cmdCtx *cmdcontext.CmdCtx, inst *InstanceCtx) error
- func Status(run *InstanceCtx) process_utils.ProcessState
- func Stop(run *InstanceCtx) error
- type Instance
- type InstanceCtx
- type Provider
- type RunFlags
- type RunOpts
- type RunningCtx
- type Watchdog
Constants ¶
const InstanceDelimiter = ':'
InstanceDelimiter is the delimiter of the app and instance name.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
func Check(cmdCtx *cmdcontext.CmdCtx, run *InstanceCtx) error
Check returns the result of checking the syntax of the application file.
func ExtractActiveAppNames ¶ added in v1.1.1
func ExtractActiveAppNames(instances []InstanceCtx) []string
ExtractActiveAppNames returns the names of applications, that have a running instance.
func ExtractActiveInstanceNames ¶ added in v1.1.1
func ExtractActiveInstanceNames(instances []InstanceCtx) []string
ExtractActiveInstanceNames returns the names of running instances.
func ExtractAppNames ¶ added in v1.1.1
func ExtractAppNames(instances []InstanceCtx) []string
ExtractAppNames returns the names of apps.
func ExtractInactiveAppNames ¶ added in v1.1.1
func ExtractInactiveAppNames(instances []InstanceCtx) []string
ExtractInactiveAppNames returns the names of applications, that have a not running instance.
func ExtractInactiveInstanceNames ¶ added in v1.1.1
func ExtractInactiveInstanceNames(instances []InstanceCtx) []string
ExtractInactiveInstanceNames returns the names of not running instances.
func ExtractInstanceNames ¶ added in v1.1.1
func ExtractInstanceNames(instances []InstanceCtx) []string
ExtractInstanceNames returns the names of instances.
func FillCtx ¶
func FillCtx(cliOpts *config.CliOpts, cmdCtx *cmdcontext.CmdCtx, runningCtx *RunningCtx, args []string) error
FillCtx fills the RunningCtx context.
func GetAppInstanceName ¶ added in v0.3.0
func GetAppInstanceName(instance InstanceCtx) string
GetAppInstanceName returns the full instance name for the passed context. If an application is multi-instance, the format will be AppName:InstName. Otherwise, the format is AppName.
func IsAbleToStartInstances ¶ added in v1.3.0
func IsAbleToStartInstances(instances []InstanceCtx, cmdCtx *cmdcontext.CmdCtx) ( bool, string)
IsAbleToStartInstances checks if it is possible to start instances.
func IsInstanceActive ¶ added in v1.1.1
func IsInstanceActive(instance *InstanceCtx) bool
IsInstanceActive returns true if the instance have running status.
func IsInstanceInactive ¶ added in v1.1.1
func IsInstanceInactive(instance *InstanceCtx) bool
IsInstanceInactive return true if the instance have not running status.
func Logrotate ¶
func Logrotate(run *InstanceCtx) (string, error)
Logrotate rotates logs of a started tarantool instance.
func NewArtifactsPathBuilder ¶ added in v1.0.0
func NewArtifactsPathBuilder(baseDir, appName string) *artifactsPathBuilder
NewArtifactsPathBuilder creates new builder for paths generation.
func Status ¶
func Status(run *InstanceCtx) process_utils.ProcessState
Status returns the status of the Instance.
Types ¶
type Instance ¶
type Instance interface { // Start starts the Instance with the specified parameters. Start() error // Run runs tarantool interpreter. Run(flags RunFlags) error // Wait waits for the process to complete. Wait() error // SendSignal sends a signal to the process. SendSignal(sig os.Signal) error // IsAlive verifies that the instance is alive. IsAlive() bool // Stop terminates the process. // // waitTimeout - the time that was provided to the process // to terminate correctly before killing it. Stop(waitTimeout time.Duration) error }
Instance describes a running tarantool instance.
type InstanceCtx ¶
type InstanceCtx struct { // AppDir is an application directory. AppDir string // InstanceScript is a script to run if any. InstanceScript string // AppName contains the name of the application as it was passed on start. AppName string // Instance name. InstName string // Directory that stores various instance runtime artifacts like // console socket, PID file, etc. RunDir string // Directory that stores log files. LogDir string // Log is the name of log file. Log string // WalDir is a directory where write-ahead log (.xlog) files are stored. WalDir string // MemtxDir is a directory where memtx stores snapshot (.snap) files. MemtxDir string `mapstructure:"memtx_dir" yaml:"memtx_dir"` // VinylDir is a directory where vinyl files or subdirectories will be stored. VinylDir string `mapstructure:"vinyl_dir" yaml:"vinyl_dir"` // LogMaxSize is the maximum size in megabytes of the log file // before it gets rotated. It defaults to 100 megabytes. LogMaxSize int // LogMaxBackups is the maximum number of old log files to retain. // The default is to retain all old log files (though LogMaxAge may // still cause them to get deleted). LogMaxBackups int // LogMaxAge is the maximum number of days to retain old log files // based on the timestamp encoded in their filename. Note that a // day is defined as 24 hours and may not exactly correspond to // calendar days due to daylight savings, leap seconds, etc. The // default is not to remove old log files based on age. LogMaxAge int // The name of the file with the watchdog PID under which the // instance was started. PIDFile string // If the instance is started under the watchdog it should // restart on if it crashes. Restartable bool // Control UNIX socket for started instance. ConsoleSocket string // True if this is a single instance application (no instances.yml). SingleApp bool // ClusterConfigPath is a path of cluster configuration. ClusterConfigPath string // Configuration is instance configuration loaded from cluster config. Configuration cluster.InstanceConfig }
InstanceCtx contains information about application instance.
func CollectInstances ¶ added in v1.0.0
func CollectInstances(appName string, applicationsDir string) ([]InstanceCtx, error)
CollectInstances searches all instances available in application.
type Provider ¶
type Provider interface { // CreateInstance is used to create a new instance on restart. CreateInstance(logger *ttlog.Logger) (Instance, error) // UpdateLogger updates the logger settings or creates a new logger, // if passed nil. UpdateLogger(logger *ttlog.Logger) (*ttlog.Logger, error) // IsRestartable checks IsRestartable() (bool, error) }
Provider interface provides Watchdog methods to get objects whose creation and updating may depend on changing external parameters (such as configuration file).
type RunFlags ¶
type RunFlags struct { // RunEval contains "-e" flag content. RunEval string // RunLib contains "-l" flag content. RunLib string // RunInteractive contains "-i" flag content. RunInteractive bool // RunStdin contains "-" flag content. RunStdin string // RunVersion contains "-v" flag content. RunVersion bool // RunArgs contains command args. RunArgs []string }
RunFlags contains flags for tt run.
type RunOpts ¶
type RunOpts struct { CmdCtx cmdcontext.CmdCtx RunningCtx RunningCtx RunFlags RunFlags }
RunOpts contains information for tt run.
type RunningCtx ¶
type RunningCtx struct { // Instances contains information about application instances. Instances []InstanceCtx }
Running contains information about application instances.
type Watchdog ¶
type Watchdog struct {
// contains filtered or unexported fields
}
Watchdog is a process that controls an Instance process.