sync

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPlan

func ApplyPlan(ctx context.Context, srcFS FileSystem, dstFS FileSystem, plan *Plan, options ApplyOptions) error

Types

type ApplyOptions

type ApplyOptions struct {
	Delete      bool
	Permission  bool
	ParallelNum int
	Output      *output.Output
}

type CommandArgs

type CommandArgs struct {
	Delete      bool
	Permission  bool
	ParallelNum int
	Sources     []string
	Destination string
}

func ParseCommandArgs

func ParseCommandArgs(args []string) (CommandArgs, error)

type DeleteScope

type DeleteScope struct {
	Path  string
	IsDir bool
}

type DesiredEntry

type DesiredEntry struct {
	SourcePath      string
	DestinationPath string
	RelPath         string
	Mode            fs.FileMode
	Size            int64
	ModTime         time.Time
	IsDir           bool
}

type FileSystem

type FileSystem interface {
	Expand(raw string) ([]string, error)
	Resolve(raw string) (string, error)
	Stat(path string) (fs.FileInfo, error)
	Walk(root string, fn func(path string, info fs.FileInfo) error) error
	Open(path string) (io.ReadCloser, error)
	OpenWriter(path string, perm fs.FileMode) (io.WriteCloser, error)
	MkdirAll(path string) error
	Remove(path string) error
	RemoveDir(path string) error
	Chmod(path string, mode fs.FileMode) error
	Chtimes(path string, atime, mtime time.Time) error
	Clean(path string) string
	Join(elem ...string) string
	Dir(path string) string
	Separator() string
}

func NewLocalFS

func NewLocalFS() (FileSystem, error)

func NewRemoteFS

func NewRemoteFS(client *sftp.Client, pwd string) FileSystem

type PathSpec

type PathSpec struct {
	IsRemote bool
	Hosts    []string
	Path     string
	Raw      string
}

func ParsePathSpec

func ParsePathSpec(arg string) (PathSpec, error)

type Plan

type Plan struct {
	Desired      map[string]DesiredEntry
	DeleteScopes []DeleteScope
}

func BuildPlan

func BuildPlan(srcFS FileSystem, dstFS FileSystem, sourceArgs []string, destination string) (*Plan, error)

type Sync

type Sync struct {
	Run *sshl.Run

	From SyncInfo
	To   SyncInfo

	Config      conf.Config
	Permission  bool
	Delete      bool
	ParallelNum int

	Progress   *mpb.Progress
	ProgressWG *syncpkg.WaitGroup
}

func (*Sync) Start

func (s *Sync) Start()

type SyncConnect

type SyncConnect struct {
	Server  string
	Connect *sftp.Client
	Output  *output.Output
	Pwd     string
}

type SyncInfo

type SyncInfo struct {
	IsRemote bool
	Server   []string
	Path     []string
}

Jump to

Keyboard shortcuts

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