/*
Copyright 2018 Pressinfra SRL

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package sidecar

import (
	"strconv"
	"time"

	// add mysql driver
	_ "github.com/go-sql-driver/mysql"

	"github.com/bitpoke/mysql-operator/pkg/util/constants"
)

var (
	// MysqlServerIDOffset represents the offset with which all server ids are shifted from 0
	MysqlServerIDOffset = 100

	// MysqlPort represents port on which mysql works
	mysqlPort = strconv.Itoa(constants.MysqlPort)

	// ConfigDir is the mysql configs path, /etc/mysql
	configDir = constants.ConfVolumeMountPath

	// ConfDPath is /etc/mysql/conf.d
	confDPath = constants.ConfDPath

	// MountConfigDir is the mounted configs that needs processing
	mountConfigDir = constants.ConfMapVolumeMountPath

	// confClientPath the path where to put the client.conf file
	confClientPath = constants.ConfClientPath

	// confHeartbeatPath the path where to put the heartbeat.conf file
	confHeartbeatPath = constants.ConfHeartBeatPath

	// DataDir is the mysql data. /var/lib/mysql
	dataDir = constants.DataVolumeMountPath

	// ToolsDbName is the name of the tools table
	toolsDbName = constants.OperatorDbName

	// toolsHeartbeatTableName is the name used for pt-heartbeat table
	toolsHeartbeatTableName = "heartbeat"

	// heartBeatUserName is the MySQL user that is used for pt-heartbeat
	heartBeatUserName = "sys_heartbeat"

	// ServerPort http server port
	serverPort = constants.SidecarServerPort
	// ServerProbeEndpoint is the http server endpoint for probe
	serverProbeEndpoint = constants.SidecarServerProbePath
	// ServerBackupEndpoint is the http server endpoint for backups
	serverBackupEndpoint = "/xbackup"
	// ServerDialTimeout is the connect timeout (not http timeout) for requesting a backup from the sidecar server
	serverConnectTimeout = 5 * time.Second

	// xtrabackup Executable Name
	xtrabackupCommand = "xtrabackup"

	// xbstream Executable Name
	xbstreamCommand = "xbstream"

	shPreStop = constants.ShPreStop
)
