Documentation
¶
Index ¶
- Constants
- func DivMod(numerator, denominator int64) (quotient, remainder int64)
- func FindStringSubmatchIndexes(re *regexp.Regexp, s string) map[string][2]int
- func FormatDurationToDaysHoursMinsSecs(dur time.Duration, short bool, sections *int) string
- func FormatSize(byteCount uint64, short bool) string
- func GetAppArchitecture() string
- func GetAppExtraTitle() string
- func GetAppFullTitle() string
- func GetAppTitle() string
- func GetAppVersion() string
- func GetGolangVersion() string
- func GetReadableSize(size FolderSize) string
- func GetRelativePath(rootDest, destPath string) (string, error)
- func GetRelativePaths(rootDest string, paths []string) ([]string, error)
- func Round(x float64) float64
- func RsyncPathJoin(elements ...string) string
- func RunExecutableWithExtraVars(pathToApp string, env []string, args ...string) (int, error)
- func SetAppRunMode(appRunMode AppRunMode)
- func SetBuildNum(buildnum string)
- func SetVersion(version string)
- func SplitByEOL(text string) []string
- type AppRunMode
- type Dir
- type DirMetrics
- type FolderBackupType
- type FolderSize
- type ProxyLog
- func (v *ProxyLog) Debug(args ...interface{})
- func (v *ProxyLog) Debugf(format string, args ...interface{})
- func (v *ProxyLog) Error(args ...interface{})
- func (v *ProxyLog) Errorf(format string, args ...interface{})
- func (v *ProxyLog) Fatal(args ...interface{})
- func (v *ProxyLog) Fatalf(format string, args ...interface{})
- func (v *ProxyLog) Info(args ...interface{})
- func (v *ProxyLog) Infof(format string, args ...interface{})
- func (v *ProxyLog) Notify(args ...interface{})
- func (v *ProxyLog) Notifyf(format string, args ...interface{})
- func (v *ProxyLog) Panic(args ...interface{})
- func (v *ProxyLog) Panicf(format string, args ...interface{})
- func (v *ProxyLog) Print(level logger.LogLevel, args ...interface{})
- func (v *ProxyLog) Printf(level logger.LogLevel, format string, args ...interface{})
- func (v *ProxyLog) Warn(args ...interface{})
- func (v *ProxyLog) Warnf(format string, args ...interface{})
- func (v *ProxyLog) Warning(args ...interface{})
- func (v *ProxyLog) Warningf(format string, args ...interface{})
- type SizeProgress
- type SrcDstPath
- type WriteLine
Constants ¶
const ( KB = 1000 MB = 1000 * KB GB = 1000 * MB TB = 1000 * GB PB = 1000 * TB EB = 1000 * PB )
byte count in corresponding data measurements
const ( MsgAppTitleExtra = "AppTitleExtra" MsgDaysLong = "DaysLong" MsgDaysShort = "DaysShort" MsgHoursLong = "HoursLong" MsgHoursShort = "HoursShort" MsgMinutesLong = "MinutesLong" MsgMinutesShort = "MinutesShort" MsgSecondsLong = "SecondsLong" MsgSecondsShort = "SecondsShort" MsgBytesLong = "BytesLong" MsgBytesShort = "BytesShort" MsgKiloBytesLong = "KiloBytesLong" MsgKiloBytesShort = "KiloBytesShort" MsgMegaBytesLong = "MegaBytesLong" MsgMegaBytesShort = "MegaBytesShort" MsgGigaBytesLong = "GigaBytesLong" MsgGigaBytesShort = "GigaBytesShort" MsgTeraBytesLong = "TeraBytesLong" MsgTeraBytesShort = "TeraBytesShort" MsgPetaBytesLong = "PetaBytesLong" MsgPetaBytesShort = "PetaBytesShort" MsgExaBytesLong = "ExaBytesLong" MsgExaBytesShort = "ExaBytesShort" )
Variables ¶
This section is empty.
Functions ¶
func DivMod ¶ added in v0.3.3
DivMod return integer devision characteristics: quotient and remainder.
func FindStringSubmatchIndexes ¶
FindStringSubmatchIndexes simplify named Regexp subexpressions extraction via map interface. Each entry return 2-byte array with start/end indexes of occurrence.
func FormatDurationToDaysHoursMinsSecs ¶
FormatDurationToDaysHoursMinsSecs print time span in the format "x1 day(s) x2 hour(s) x3 minute(s) x4 second(s)". Understand plural cases for right spellings. Might be limited to number of sections to print.
func FormatSize ¶
FormatSize convert byte count amount to human-readable (short) string representation.
func GetAppArchitecture ¶
func GetAppArchitecture() string
GetAppArchitecture1 returns application architecture.
func GetAppExtraTitle ¶
func GetAppExtraTitle() string
GetAppExtraTitle returns application translatable extra title.
func GetAppFullTitle ¶
func GetAppFullTitle() string
GetAppFullTitle returns application full title.
func GetAppTitle ¶
func GetAppTitle() string
GetAppTitle returns application non-translatable title.
func GetAppVersion ¶
func GetAppVersion() string
GetAppVersion returns string representation of application version.
func GetGolangVersion ¶
func GetGolangVersion() string
GetGolangVersion returns golang version used to compile application.
func GetReadableSize ¶
func GetReadableSize(size FolderSize) string
GetReadableSize convert FolderSize to human readable string representation.
func GetRelativePath ¶
GetRelativePath cut off root prefix from destPath (if found).
func GetRelativePaths ¶
GetRelativePaths cut off root prefix from multiple paths (if found).
func Round ¶
Round returns the nearest integer, rounding ties away from zero. This functionality is for "before Go 1.10" period, because math.Round() was added only since Go 1.10.
func RsyncPathJoin ¶
RsyncPathJoin used to join path elements in RSYNC url.
func RunExecutableWithExtraVars ¶
RunExecutableWithExtraVars execute external process returning exit code either any error which might happens during start up or execution phases.
func SetAppRunMode ¶ added in v0.4.0
func SetAppRunMode(appRunMode AppRunMode)
func SetBuildNum ¶
func SetBuildNum(buildnum string)
SetBuildNum save application build number provided with compile via -ldflags CLI parameter.
Types ¶
type AppRunMode ¶ added in v0.4.0
type AppRunMode int
AppRunMode signify what happens, when app will be closed. With this type standard behavior might be changed and app will be started again.
const ( // AppRegularRun - regular run, app will be closed on exit. AppRegularRun AppRunMode = iota // AppRunReload - app will be reinitialized and restarted again. // This behavior allow to automatically restart app when some // settings change require app to reload. AppRunReload )
func GetAppRunMode ¶ added in v0.4.0
func GetAppRunMode() AppRunMode
type Dir ¶
type Dir struct { Paths SrcDstPath Name string Parent *Dir Childs []*Dir Metrics DirMetrics }
Dir is a "tree data structure" to describe folder's tree received from the source in 1st pass of backup process to measure counts/sizes and to predict time necessary for backup process (ETA). https://en.wikipedia.org/wiki/Tree_%28data_structure%29
func BuildDirTree ¶
func BuildDirTree(paths SrcDstPath, ignoreBackupFileSigName string) (*Dir, error)
BuildDirTree scans and creates Dir object which reflects real recursive directory structure defined by file system path in paths argument.
func (*Dir) GetContentBackupSize ¶
func (v *Dir) GetContentBackupSize() FolderSize
GetContentBackupSize calculates total size of data which marked to backup "local folder content".
func (*Dir) GetFoldersCount ¶
GetFoldersCount return total folder count in this directory tree.
func (*Dir) GetFoldersIgnoreCount ¶
GetFoldersIgnoreCount return total folder count to "skip to backup" in this directory tree.
func (*Dir) GetFullBackupSize ¶
func (v *Dir) GetFullBackupSize() FolderSize
GetFullBackupSize calculates total size of data which marked to backup "full content".
func (*Dir) GetIgnoreSize ¶
func (v *Dir) GetIgnoreSize() FolderSize
GetIgnoreSize calculates total size of data which marked as "skip to backup" including all subfolders.
func (*Dir) GetTotalSize ¶
func (v *Dir) GetTotalSize() FolderSize
GetTotalSize calculates total size of data to backup, including all subfolders.
type DirMetrics ¶
type DirMetrics struct { // Define depth from root folder. Root folder has Depth = 0. Depth int // Total count of all child folders. ChildrenCount int // "Size" metric defines summary size of all local files, // do not include any child folders. Size *FolderSize // "Full size" metric, which include all files and // child folders with their content. FullSize *FolderSize // Flag which means, that folder contain special file // which serves as signal to skip backup this folder. IgnoreToBackup bool // Flag which means, that this folder already marked // as "measured" in traverse path search. Measured bool // Type of backup for current folder defined // as a result of traverse path search. BackupType FolderBackupType }
DirMetrics keeps metrics defined in 1st pass of folders tree. Metrics used lately in heuristic algorithm to find optimal folder tree traverse.
type FolderBackupType ¶
type FolderBackupType int
FolderBackupType define how to backup folder content.
const ( // FBT_UNKNOWN denotes undefined backup approach. FBT_UNKNOWN FolderBackupType = iota // FBT_SKIP denotes skip to backup folder content (including subfolders). FBT_SKIP // FBT_RECURSIVE denotes backup full folder content including all subfolders. FBT_RECURSIVE // FBT_CONTENT denotes backup only files located directly in the folder. Do not backup subfolders. FBT_CONTENT )
func (FolderBackupType) String ¶
func (v FolderBackupType) String() string
String implement Stringer interface.
type FolderSize ¶
type FolderSize int64
FolderSize used to signify size of backup objects.
func NewFolderSize ¶
func NewFolderSize(size int64) FolderSize
NewFolderSize create new FolderSize instance.
func (FolderSize) Add ¶
func (v FolderSize) Add(value FolderSize) FolderSize
Add combines sizes of two FolderSize objects.
func (FolderSize) AddSizeProgress ¶
func (v FolderSize) AddSizeProgress(value SizeProgress) FolderSize
AddSizeProgress accumulate all sizes from SizeProgress with instance size.
func (FolderSize) GetByteCount ¶
func (v FolderSize) GetByteCount() uint64
GetByteCount returns size of FolderSize in bytes.
type ProxyLog ¶
type ProxyLog struct {
// contains filtered or unexported fields
}
ProxyLog is used to substitute regular log console output with output to the file, either to the GUI window. ProxyLog implements logger.PackageLog interface which provide regular log methods.
func NewProxyLog ¶
func (*ProxyLog) Debug ¶
func (v *ProxyLog) Debug(args ...interface{})
Debug implement logger.PackageLog.Debug method.
func (*ProxyLog) Debugf ¶
Debugf implement logger.PackageLog.Debugf method.
func (*ProxyLog) Error ¶
func (v *ProxyLog) Error(args ...interface{})
Error implement logger.PackageLog.Error method.
func (*ProxyLog) Errorf ¶
Errorf implement logger.PackageLog.Errorf method.
func (*ProxyLog) Fatal ¶
func (v *ProxyLog) Fatal(args ...interface{})
Fatal implement logger.PackageLog.Fatal method.
func (*ProxyLog) Fatalf ¶
Fatalf implement logger.PackageLog.Fatalf method.
func (*ProxyLog) Info ¶
func (v *ProxyLog) Info(args ...interface{})
Info implement logger.PackageLog.Info method.
func (*ProxyLog) Infof ¶
Infof implement logger.PackageLog.Infof method.
func (*ProxyLog) Notify ¶
func (v *ProxyLog) Notify(args ...interface{})
Notify implement logger.PackageLog.Notify method.
func (*ProxyLog) Notifyf ¶
Notifyf implement logger.PackageLog.Notifyf method.
func (*ProxyLog) Panic ¶
func (v *ProxyLog) Panic(args ...interface{})
Panic implement logger.PackageLog.Panic method.
func (*ProxyLog) Panicf ¶
Panicf implement logger.PackageLog.Panicf method.
func (*ProxyLog) Print ¶
Print implement logger.PackageLog.Print method.
func (*ProxyLog) Printf ¶
Printf implement logger.PackageLog.Printf method.
func (*ProxyLog) Warn ¶
func (v *ProxyLog) Warn(args ...interface{})
Warn implement logger.PackageLog.Warn method.
func (*ProxyLog) Warnf ¶
Warnf implement logger.PackageLog.Warnf method.
type SizeProgress ¶
type SizeProgress struct { // Completed signify successfully backed up size. Completed *FolderSize // Skipped signify size that was skipped during backup process. Skipped *FolderSize // Failed signify size that was not backed up due to some issues. Failed *FolderSize }
SizeProgress keeps all sizes which may arise during backup process.
func NewProgressCompleted ¶
func NewProgressCompleted(size FolderSize) SizeProgress
NewProgressCompleted creates the SizeProgress object with the size that was successfully backed up.
func NewProgressFailed ¶
func NewProgressFailed(size FolderSize) SizeProgress
NewProgressFailed creates the SizeProgress object with the size that was not backed up due to some issues.
func NewProgressSkipped ¶
func NewProgressSkipped(size FolderSize) SizeProgress
NewProgressSkipped creates the SizeProgress object with the size that was skipped.
func (*SizeProgress) Add ¶
func (v *SizeProgress) Add(size SizeProgress)
Add combines sizes of two SizeProgress objects.
func (*SizeProgress) GetTotal ¶
func (v *SizeProgress) GetTotal() FolderSize
GetTotal gets total SizeProgress size.
type SrcDstPath ¶
SrcDstPath link to each other RSYNC source URL with destination extra path added to backup folder.
func (SrcDstPath) Join ¶
func (v SrcDstPath) Join(item string) SrcDstPath
Join fork SrcDstPath with new variant, where new "folder" appended to the end of the path.