rsync

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgRsyncCallFailedError                  = "RsyncCallFailedError"
	MsgRsyncProcessTerminatedError           = "RsyncProcessTerminatedError"
	MsgRsyncCannotFindFolderSizeOutputError  = "RsyncCannotFindFolderSizeOutputError"
	MsgRsyncCannotParseFolderSizeOutputError = "RsyncCannotParseFolderSizeOutputError"
)
View Source
const RSYNC_CMD = "rsync"

RSYNC_CMD contains RSYNC console utility name to run.

Variables

This section is empty.

Functions

func GetPathStatus

func GetPathStatus(ctx context.Context, sourceRSync string, recursive bool) error

func GetRsyncVersion

func GetRsyncVersion() (version string, protocol string, err error)

GetRsyncVersion run RSYNC to get version and protocol.

func IsInstalled

func IsInstalled() error

IsInstalled verify, that RSYNC application present in the system.

func IsRsyncCallFailedError

func IsRsyncCallFailedError(err error) bool

func IsRsyncProcessTerminatedError

func IsRsyncProcessTerminatedError(err error) bool

func ObtainDirFullSize

func ObtainDirFullSize(ctx context.Context, dir *core.Dir, retryCount *int, log *Logging) (*core.FolderSize, error)

func ObtainDirLocalSize

func ObtainDirLocalSize(ctx context.Context, dir *core.Dir, retryCount *int, log *Logging) (*core.FolderSize, error)

func Params

func Params(params ...string) []string

func RunRsyncWithRetry

func RunRsyncWithRetry(ctx context.Context, options *Options, log *Logging, stdOut *bytes.Buffer,
	paths core.SrcDstPath) (sessionErr, retryErr, criticalErr error)

RunRsyncWithRetry run RSYNC utility with retry attempts.

func WithDefaultParams

func WithDefaultParams(params ...string) []string

Types

type ErrorHook

type ErrorHook func(err error, paths core.SrcDstPath, predictedSize *core.FolderSize,
	repeated int, retryLeft int) (newRetryLeft int, criticalError error)

type Logging

type Logging struct {
	EnableLog          bool
	EnableIntensiveLog bool
	Log                logger.PackageLog
}

type Options

type Options struct {
	RetryCount    int
	Params        []string
	ErrorHook     ErrorHook
	PredictedSize *core.FolderSize
}

func NewOptions

func NewOptions(params []string) *Options

func (*Options) AddParams

func (v *Options) AddParams(params ...string) *Options

func (*Options) SetErrorHook

func (v *Options) SetErrorHook(errorHook ErrorHook) *Options

func (*Options) SetPredictedSize

func (v *Options) SetPredictedSize(predictedSize core.FolderSize) *Options

func (*Options) SetRetryCount

func (v *Options) SetRetryCount(retryCount *int) *Options

type RsyncCallFailedError

type RsyncCallFailedError struct {
	ExitCode    int
	Description string
}

func NewRsyncCallFailedError

func NewRsyncCallFailedError(exitCode int) *RsyncCallFailedError

func (*RsyncCallFailedError) Error

func (v *RsyncCallFailedError) Error() string

type RsyncProcessTerminatedError

type RsyncProcessTerminatedError struct {
}

func (*RsyncProcessTerminatedError) Error

Source Files

  • abstract.go
  • common.go
  • errors.go
  • messagekeys.go
  • rsync.go
  • utils.go

Jump to

Keyboard shortcuts

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