Documentation
¶
Index ¶
- Constants
- Variables
- 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 MegabytesToBytes(size uint64) uint64
- func Round(x float64) float64
- func RsyncPathJoin(elements ...string) string
- func RunExecutableWithExtraVars(path string, env []string, args ...string) (error, int)
- func SetBuildNum(buildnum string)
- func SetVersion(version string)
- func SplitByEOL(text string) []string
- 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 ( MB = 1000 * 1000 GB = 1000 * 1000 * 1000 TB = 1000 * 1000 * 1000 * 1000 PB = 1000 * 1000 * 1000 * 1000 * 1000 EB = 1000 * 1000 * 1000 * 1000 * 1000 * 1000 )
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 ¶
var ( APP_ID = "org.d2r2.gorsync" SETTINGS_ID = APP_ID + ".Settings" SETTINGS_PROFILE_ID = SETTINGS_ID + ".Profile" SETTINGS_PROFILE_PATH = "/org/d2r2/gorsync/profiles/%s/" SETTINGS_SOURCE_ID = SETTINGS_PROFILE_ID + ".Source" SETTINGS_SOURCE_PATH = "/org/d2r2/gorsync/profiles/%s/sources/%s/" )
Functions ¶
func FindStringSubmatchIndexes ¶
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.
func GetReadableSize ¶
func GetReadableSize(size FolderSize) string
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.
func RsyncPathJoin ¶
RsyncPathJoin used to join path elements in RSYNC url.
func RunExecutableWithExtraVars ¶
Types ¶
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).
func BuildDirTree ¶
func BuildDirTree(paths SrcDstPath, ignoreBackupFileSigName string) (*Dir, error)
func (*Dir) GetContentBackupSize ¶
func (v *Dir) GetContentBackupSize() FolderSize
func (*Dir) GetFullBackupSize ¶
func (v *Dir) GetFullBackupSize() FolderSize
func (*Dir) GetIgnoreSize ¶
func (v *Dir) GetIgnoreSize() FolderSize
func (*Dir) GetTotalSize ¶
func (v *Dir) GetTotalSize() FolderSize
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 tag to do not 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
const ( FBT_UNKNOWN FolderBackupType = iota FBT_SKIP FBT_RECURSIVE FBT_CONTENT )
func (FolderBackupType) String ¶
func (v FolderBackupType) String() string
type FolderSize ¶
type FolderSize int64
func NewFolderSize ¶
func NewFolderSize(size int64) FolderSize
func (FolderSize) Add ¶
func (v FolderSize) Add(value FolderSize) FolderSize
func (FolderSize) AddSizeProgress ¶
func (v FolderSize) AddSizeProgress(value SizeProgress) FolderSize
func (FolderSize) GetByteCount ¶
func (v FolderSize) GetByteCount() uint64
type ProxyLog ¶
type ProxyLog struct {
// contains filtered or unexported fields
}
func NewProxyLog ¶
func (*ProxyLog) Printf ¶
type SizeProgress ¶
type SizeProgress struct {
Completed *FolderSize
Skipped *FolderSize
Failed *FolderSize
}
func NewProgressCompleted ¶
func NewProgressCompleted(size FolderSize) SizeProgress
func NewProgressFailed ¶
func NewProgressFailed(size FolderSize) SizeProgress
func NewProgressSkipped ¶
func NewProgressSkipped(size FolderSize) SizeProgress
func (*SizeProgress) Add ¶
func (this *SizeProgress) Add(size SizeProgress)
func (*SizeProgress) GetTotal ¶
func (this *SizeProgress) GetTotal() FolderSize
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" amended to the end of the path.
Source Files
¶
- abstract.go
- common.go
- dir.go
- format.go
- info.go
- messagekeys.go
- path.go
- proxylog.go
- utils.go