Documentation
¶
Index ¶
- 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 NewArtifactsPathBuilder(baseDir, appName string) *artifactsPathBuilder
- func Run(runOpts *RunOpts, scriptPath string) error
- func Start(cmdCtx *cmdcontext.CmdCtx, run *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 ¶
This section is empty.
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.
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 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, instanceCtx *InstanceCtx, env []string, logger *ttlog.Logger) (*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
// WalDir is a directory where write-ahead log (.xlog) files are stored.
WalDir string `mapstructure:"wal_dir" yaml:"wal_dir"`
// 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
}
InstanceCtx contains information about application instance.
func CollectInstances ¶ added in v1.0.0
func CollectInstances(appName string, appDir 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 {
// Instance describes the controlled Instance.
Instance *Instance
// contains filtered or unexported fields
}
Watchdog is a process that controls an Instance process.