Documentation ¶
Index ¶
- Variables
- func CheckBinary(path string) error
- func Copy(src, dst string, opts Options) (err error)
- func SimpleCopy(src, dst string) error
- type Config
- func (cfg *Config) CurrentBin() (string, error)
- func (cfg *Config) DownloadCode(upgradeName string) string
- func (cfg *Config) GenesisBin() string
- func (cfg *Config) GetPort() string
- func (cfg *Config) Root() string
- func (cfg *Config) SetCurrentUpgrade(upgradeName string) error
- func (cfg *Config) SymLinkToGenesis() (string, error)
- func (cfg *Config) UpgradeBin(upgradeName string) string
- func (cfg *Config) UpgradeDir(upgradeName string) string
- func (cfg *Config) Validate() error
- type File
- type Options
- type UpgradeInfo
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFileNotExist occurs when a file is given that does not exist when its existence is required. ErrFileNotExist = errors.New("no such file or directory") // ErrCannotOpenSrc occurs when a src file cannot be opened with os.Open(). ErrCannotOpenSrc = errors.New("source file cannot be opened") // ErrCannotStatFile occurs when a file receives an error from get os.Stat(). ErrCannotStatFile = errors.New("cannot stat file, check that file path is accessible") // ErrCannotChmodFile occurs when an error is received trying to change permissions on a file. ErrCannotChmodFile = errors.New("cannot change permissions on file") // ErrCannotCreateTmpFile occurs when an error is received attempting to create a temporary file for atomic copy. ErrCannotCreateTmpFile = errors.New("temp file cannot be created") // ErrCannotOpenOrCreateDstFile occurs when an error is received attempting to open or create destination file during non-atomic copy. ErrCannotOpenOrCreateDstFile = errors.New("destination file cannot be created") // ErrCannotRenameTempFile occurs when an error is received trying to rename the temporary copy file to the destination. ErrCannotRenameTempFile = errors.New("cannot rename temp file, check file or directory permissions") // ErrOmittingDir occurs when attempting to copy a directory but Options.Recursive is not set to true. ErrOmittingDir = errors.New("Options.Recursive is not true, omitting directory") // ErrWithParentsDstMustBeDir occurs when the destination is expected to be an existing directory but is not // present or accessible. ErrWithParentsDstMustBeDir = errors.New("with Options.Parents, the destination must be a directory") // ErrCannotOverwriteNonDir occurs when attempting to copy a directory to a non-directory. ErrCannotOverwriteNonDir = errors.New("cannot overwrite non-directory") // ErrReadingSrcDir occurs when attempting to read contents of the source directory fails ErrReadingSrcDir = errors.New("cannot read source directory, check source directory permissions") // ErrWritingFileToExistingDir occurs when attempting to write a file to an existing directory. // See AppendNameToPath option for a more dynamic approach. ErrWritingFileToExistingDir = errors.New("cannot overwrite existing directory with file") // ErrInvalidBackupControlValue occurs when a control value is given to the Backup option, but the value is invalid. ErrInvalidBackupControlValue = errors.New("invalid backup value, valid values are 'off', 'simple', 'existing', 'numbered'") )
Functions ¶
func CheckBinary ¶
EnsureBinary ensures the file exists and is executable, or returns an error
func SimpleCopy ¶
SimpleCopy will src to dst with default Options.
Types ¶
type Config ¶
type Config struct { Home string Name string AllowDownload bool Port string RestartAfterUpgrade bool }
Config is the information passed in to control the daemon
func GetConfigFromEnv ¶
GetConfigFromEnv will read the environmental variables into a config and then Validate it is reasonable
func (*Config) CurrentBin ¶
CurrentBin is the path to the currently selected binary (genesis if no link is set) This will resolve the symlink to the underlying directory to make it easier to debug
func (*Config) DownloadCode ¶
func (*Config) GenesisBin ¶
GenesisBin is the path to the genesis binary - must be in place to start manager
func (*Config) SetCurrentUpgrade ¶
SetCurrentUpgrade sets the named upgrade to be the current link, returns error if this binary doesn't exist
func (*Config) SymLinkToGenesis ¶
Symlink to genesis
func (*Config) UpgradeBin ¶
UpgradeBin is the path to the binary for the named upgrade
func (*Config) UpgradeDir ¶
UpgradeDir is the directory named upgrade
type File ¶
type File struct { // Path is the path to the src file. Path string // contains filtered or unexported fields }
File describes a file and associated options for operations on the file.
type Options ¶
type Options struct { // AppendNameToPath will, when attempting to copy a file to an existing directory, automatically // create the file with the same name in the destination directory. While CP uses this behavior // by default it is an assumption better left to the client in a programmatic setting. AppendNameToPath bool // Atomic will copy contents to a temporary file in the destination's parent directory first, then // rename the file to ensure the operation is atomic. Atomic bool // Backup makes a backup of each existing destination file. The backup suffix is '~'. Acceptable // control values are: // - "off" no backup will be made (default) // - "simple" always make simple backups // - "numbered" make numbered backups // - "existing" numbered if numbered backups exist, simple otherwise Backup string // Link creates hard links to files instead of copying them. Link bool // MkdirAll will use os.MkdirAll to create the destination directory if it does not exist, along with // any necessary parents. MkdirAll bool // NoClobber will not let an existing file be overwritten. NoClobber bool // Parents will create source directories in dst if they do not already exist. ErrWithParentsDstMustBeDir // is returned if destination is not a directory. Parents bool // Recursive will recurse through sub directories if set true. Recursive bool // InfoLogFunc will, if defined, handle logging info messages. InfoLogFunc func(string) // DebugLogFunc will, if defined, handle logging debug messages. DebugLogFunc func(string) // contains filtered or unexported fields }
Options directly represent command line flags associated with GNU file operations.
type UpgradeInfo ¶
UpgradeInfo is the details from the regexp
func (*UpgradeInfo) SetUpgrade ¶
func (ui *UpgradeInfo) SetUpgrade(s string) error