Documentation
¶
Index ¶
- Constants
- func Check(cmdCtx *cmdcontext.CmdCtx, run *InstanceCtx) error
- func FillCtx(cliOpts *config.CliOpts, cmdCtx *cmdcontext.CmdCtx, runningCtx *RunningCtx, ...) error
- func GetAppInstanceName(instance InstanceCtx) string
- func Logrotate(run *InstanceCtx) (string, error)
- func Run(runOpts *RunOpts, scriptPath string) error
- func Start(cmdCtx *cmdcontext.CmdCtx, run *InstanceCtx) error
- func Status(run *InstanceCtx) string
- func Stop(run *InstanceCtx) error
- type Instance
- type InstanceCtx
- type Provider
- type RunFlags
- type RunOpts
- type RunningCtx
- type Watchdog
Constants ¶
const ( InstStateStopped = process_utils.ProcStateStopped InstStateDead = process_utils.ProcStateDead InstStateRunning = process_utils.ProcStateRunning )
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 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 Logrotate ¶
func Logrotate(run *InstanceCtx) (string, error)
Logrotate rotates logs of a started tarantool instance.
Types ¶
type Instance ¶
type Instance struct { // Cmd represents an external command being prepared and run. Cmd *exec.Cmd // contains filtered or unexported fields }
Instance describes a running process.
func NewInstance ¶
func NewInstance(tarantoolPath string, appPath string, appName string, instName string, console_sock string, env []string, logger *ttlog.Logger, dataDir string) (*Instance, error)
NewInstance creates an Instance.
func (*Instance) SendSignal ¶
SendSignal sends a signal to the Instance.
type InstanceCtx ¶
type InstanceCtx struct { // Path to an application. AppPath 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 // DataDir is the directory where all the instance artifacts // are stored. DataDir string // 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 }
InstanceCtx contains information about application instance.
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 { // Instance describes the controlled Instance. Instance *Instance // contains filtered or unexported fields }
Watchdog is a process that controls an Instance process.