defaults

package
v1.73.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2023 License: Apache-2.0 Imports: 13 Imported by: 7

Documentation

Overview

DBDeployer - The MySQL Sandbox Copyright © 2006-2020 Giuseppe Maxia

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.

Index

Constants

View Source
const (
	ConfigurationDirName    string = ".dbdeployer"
	ConfigurationFileName   string = "config.json"
	ArchivesFileName        string = "archives.json"
	SandboxRegistryName     string = "sandboxes.json"
	SandboxRegistryLockName string = "sandboxes.lock"
)

Variables

View Source
var (
	ConfigurationDir        string = path.Join(homeDir, ConfigurationDirName)
	ConfigurationFile       string = path.Join(ConfigurationDir, ConfigurationFileName)
	ArchivesFile            string = path.Join(ConfigurationDir, ArchivesFileName)
	CustomConfigurationFile string = ""
	SandboxRegistry         string = path.Join(ConfigurationDir, SandboxRegistryName)
	SandboxRegistryLock     string = path.Join(common.GlobalTempDir(), SandboxRegistryLockName)
	LogSBOperations         bool   = common.IsEnvSet("DBDEPLOYER_LOGGING")
)

Functions

func CallFuncName

func CallFuncName() string

func DefaultsToMap added in v1.30.0

func DefaultsToMap() common.StringMap

Converts the defaults to a string map, useful to access single values from other operations

func DeleteFromCatalog

func DeleteFromCatalog(sbName string) error

Safe deletion of a catalog entry

func LoadConfiguration

func LoadConfiguration()

func RemoveDefaultsFile

func RemoveDefaultsFile()

func ResetDefaults added in v1.39.0

func ResetDefaults()

func ShowDefaults

func ShowDefaults(defaults DbdeployerDefaults)

func UpdateCatalog

func UpdateCatalog(sbName string, details SandboxItem) error

Safe update of the catalog, protected by a lock

func UpdateDefaults

func UpdateDefaults(label, value string, storeDefaults bool)

func ValidateDefaults

func ValidateDefaults(nd DbdeployerDefaults) bool

func WriteDefaultsFile

func WriteDefaultsFile(filename string, defaults DbdeployerDefaults)

Types

type DbdeployerDefaults

type DbdeployerDefaults struct {
	Version                       string `json:"version"`
	SandboxHome                   string `json:"sandbox-home"`
	SandboxBinary                 string `json:"sandbox-binary"`
	UseSandboxCatalog             bool   `json:"use-sandbox-catalog"`
	LogSBOperations               bool   `json:"log-sb-operations"`
	LogDirectory                  string `json:"log-directory"`
	CookbookDirectory             string `json:"cookbook-directory"`
	ShellPath                     string `json:"shell-path"`
	MasterSlaveBasePort           int    `json:"master-slave-base-port"`
	GroupReplicationBasePort      int    `json:"group-replication-base-port"`
	GroupReplicationSpBasePort    int    `json:"group-replication-sp-base-port"`
	FanInReplicationBasePort      int    `json:"fan-in-replication-base-port"`
	AllMastersReplicationBasePort int    `json:"all-masters-replication-base-port"`
	MultipleBasePort              int    `json:"multiple-base-port"`
	PxcBasePort                   int    `json:"pxc-base-port"`
	NdbBasePort                   int    `json:"ndb-base-port"`
	NdbClusterPort                int    `json:"ndb-cluster-port"`
	GroupPortDelta                int    `json:"group-port-delta"`
	MysqlXPortDelta               int    `json:"mysqlx-port-delta"`
	AdminPortDelta                int    `json:"admin-port-delta"`
	MasterName                    string `json:"master-name"`
	MasterAbbr                    string `json:"master-abbr"`
	NodePrefix                    string `json:"node-prefix"`
	SlavePrefix                   string `json:"slave-prefix"`
	SlaveAbbr                     string `json:"slave-abbr"`
	SandboxPrefix                 string `json:"sandbox-prefix"`
	ImportedSandboxPrefix         string `json:"imported-sandbox-prefix"`
	MasterSlavePrefix             string `json:"master-slave-prefix"`
	GroupPrefix                   string `json:"group-prefix"`
	GroupSpPrefix                 string `json:"group-sp-prefix"`
	MultiplePrefix                string `json:"multiple-prefix"`
	FanInPrefix                   string `json:"fan-in-prefix"`
	AllMastersPrefix              string `json:"all-masters-prefix"`
	ReservedPorts                 []int  `json:"reserved-ports"`
	RemoteRepository              string `json:"remote-repository"`
	RemoteIndexFile               string `json:"remote-index-file"`
	RemoteCompletionUrl           string `json:"remote-completion-url"`
	RemoteTarballUrl              string `json:"remote-tarball-url"`
	PxcPrefix                     string `json:"pxc-prefix"`
	NdbPrefix                     string `json:"ndb-prefix"`
	DefaultSandboxExecutable      string `json:"default-sandbox-executable"`
	DownloadNameLinux             string `json:"download-name-linux"`
	DownloadNameMacOs             string `json:"download-name-macos"`
	DownloadUrl                   string `json:"download-url"`
	Timestamp                     string `json:"timestamp"`
}

func Defaults

func Defaults() DbdeployerDefaults

func ReadDefaultsFile

func ReadDefaultsFile(filename string) (defaults DbdeployerDefaults)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(logDir, logFileName string) (*Logger, string, error)

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...interface{})

Calling Logger.Printf will print what was requested, with an additional prefix made of :

  • dbdeployer Process ID
  • the current operation number
  • the name of the caller function

type SandboxCatalog

type SandboxCatalog map[string]SandboxItem

func ReadCatalog

func ReadCatalog() (sc SandboxCatalog, err error)

Reads the catalog, making sure that there are no concurrent operations

type SandboxItem

type SandboxItem struct {
	Origin            string   `json:"origin"`
	SBType            string   `json:"type"` // single multi master-slave group all-masters fan-in ndb pxc
	Version           string   `json:"version"`
	Flavor            string   `json:"flavor,omitempty"`
	Host              string   `json:"host,omitempty"`
	Port              []int    `json:"port"`
	Nodes             []string `json:"nodes"`
	Destination       string   `json:"destination"`
	DbDeployerVersion string   `json:"dbdeployer-version"`
	Timestamp         string   `json:"timestamp"`
	LogDirectory      string   `json:"log-directory,omitempty"`
	CommandLine       string   `json:"command-line"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL