Documentation
¶
Overview ¶
Package bisync implements bisync Copyright (c) 2017-2020 Chris Nelson
Package bisync implements bisync Copyright (c) 2017-2020 Chris Nelson
Package bisync implements bisync Copyright (c) 2017-2020 Chris Nelson
Package bisync implements bisync Copyright (c) 2017-2020 Chris Nelson Contributions to original python version: Hildo G. Jr., e2t, kalemas, silenceleaf
Index ¶
- Constants
- Variables
- func Bisync(ctx context.Context, fs1, fs2 fs.Fs, optArg *Options) (err error)
- func CheckFn(ctx context.Context, dst, src fs.Object) (differ bool, noHash bool, err error)
- func Color(style string, s string) string
- func ColorX(style string, s string) string
- func Concat[S ~[]E, E any](ss ...S) S
- func DownloadCheckFn(ctx context.Context, a, b fs.Object) (differ bool, noHash bool, err error)
- func FsPathIfAny(x fs.DirEntry) string
- func ID(o fs.Object) string
- func SuffixName(ctx context.Context, remote, suffix string) string
- type CheckSyncMode
- type CompareOpt
- type ConflictLoserAction
- type Options
- type Prefer
- type Results
- type ResultsSlice
- type TestFunc
Constants ¶
const ( DefaultMaxDelete int = 50 DefaultCheckFilename string = "RCLONE_TEST" )
Default values
const ListingHeader = "# bisync listing v1 from"
ListingHeader defines first line of a listing
Variables ¶
var ( // TZ defines time zone used in listings TZ = time.UTC // LogTZ defines time zone used in logs (which may be different than that used in listings). // time.Local by default, but we force UTC on tests to make them deterministic regardless of tester's location. LogTZ = time.Local )
var ( Colors bool ColorsLock sync.Mutex )
Colors controls whether terminal colors are enabled
var ConflictLoserList = Opt.ConflictLoser.Help()
ConflictLoserList is a list of --conflict-loser flag choices used in the help
var ConflictResolveList = Opt.ConflictResolve.Help()
ConflictResolveList is a list of --conflict-resolve flag choices used in the help
var DefaultWorkdir = filepath.Join(config.GetCacheDir(), "bisync")
DefaultWorkdir is default working directory
var ErrBisyncAborted = errors.New("bisync aborted")
ErrBisyncAborted signals that bisync is aborted and forces non-zero exit code
Functions ¶
func Concat ¶ added in v1.66.0
func Concat[S ~[]E, E any](ss ...S) S
Concat returns a new slice concatenating the passed in slices.
func DownloadCheckFn ¶ added in v1.66.0
DownloadCheckFn is a slightly modified version of Check with --download
func FsPathIfAny ¶ added in v1.66.0
FsPathIfAny handles type assertions and returns a formatted bilib.FsPath if valid, otherwise ""
func SuffixName ¶ added in v1.66.0
SuffixName adds the current --conflict-suffix to the remote, obeying --suffix-keep-extension if set It is a close cousin of operations.SuffixName, but we don't want to use ci.Suffix for this because it might be used for --backup-dir.
Types ¶
type CheckSyncMode ¶
type CheckSyncMode int
CheckSyncMode controls when to compare final listings
const ( CheckSyncTrue CheckSyncMode = iota // Compare final listings (default) CheckSyncFalse // Disable comparison of final listings CheckSyncOnly // Only compare listings from the last run, do not sync )
CheckSync modes
func (*CheckSyncMode) Set ¶
func (x *CheckSyncMode) Set(s string) error
Set a CheckSync mode from a string
func (CheckSyncMode) String ¶
func (x CheckSyncMode) String() string
type CompareOpt ¶ added in v1.66.0
type CompareOpt = struct { Modtime bool Size bool Checksum bool HashType1 hash.Type HashType2 hash.Type NoSlowHash bool SlowHashSyncOnly bool SlowHashDetected bool DownloadHash bool }
CompareOpt describes the Compare options in force
type ConflictLoserAction ¶ added in v1.66.0
ConflictLoserAction describes possible actions to take on the loser of a sync conflict
const ( ConflictLoserSkip ConflictLoserAction = iota // Reserved as zero but currently unused ConflictLoserNumber // file.conflict1, file.conflict2, file.conflict3, etc. ConflictLoserPathname // file.path1, file.path2 ConflictLoserDelete // delete the loser, keep winner only )
Supported --conflict-loser actions
type Options ¶
type Options struct { Resync bool // whether or not this is a resync ResyncMode Prefer // which mode to use for resync CheckAccess bool CheckFilename string CheckSync CheckSyncMode CreateEmptySrcDirs bool RemoveEmptyDirs bool MaxDelete int // percentage from 0 to 100 Force bool FiltersFile string Workdir string OrigBackupDir string BackupDir1 string BackupDir2 string DryRun bool NoCleanup bool SaveQueues bool // save extra debugging files (test only flag) IgnoreListingChecksum bool Resilient bool Recover bool TestFn TestFunc // test-only option, for mocking errors Compare CompareOpt CompareFlag string DebugName string MaxLock fs.Duration ConflictResolve Prefer ConflictLoser ConflictLoserAction ConflictSuffixFlag string ConflictSuffix1 string ConflictSuffix2 string }
Options keep bisync options
var Opt Options
Opt keeps command line options internal functions should use b.opt instead
type Results ¶ added in v1.66.0
type Results struct { Src string Dst string Name string AltName string Size int64 Modtime time.Time Hash string Flags string Sigil operations.Sigil Err error Winner operations.Winner IsWinner bool IsSrc bool IsDst bool Origin string }
Results represents a pair of synced files, as reported by the LoggerFn Bisync uses this to determine what happened during the sync, and modify the listings accordingly
func ReadResults ¶ added in v1.66.0
ReadResults decodes the JSON data from WriteResults
type ResultsSlice ¶ added in v1.66.0
type ResultsSlice []Results
ResultsSlice is a slice of Results (obviously)