sync

package
v1.1.1-0...-9418116 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompilePaths

func CompilePaths(excludePaths []string) (gitignore.IgnoreParser, error)

CompilePaths compiles the exclude paths into an ignore parser

func RecursiveTar

func RecursiveTar(basePath, relativePath string, writtenFiles map[string]*FileInformation, tw *tar.Writer, ignoreMatcher gitignore.IgnoreParser) error

RecursiveTar runs recursively over the given path and basepath and tars the found files and folders

Types

type FileInformation

type FileInformation struct {
	Name      string
	Size      int64
	Mtime     int64
	MtimeNano int64

	IsSymbolicLink bool
	IsDirectory    bool
}

FileInformation describes a path or file that is synced either in the remote container or locally

func (*FileInformation) Event

func (f *FileInformation) Event() notify.Event

Event implements interface

func (*FileInformation) Path

func (f *FileInformation) Path() string

Path implements interface

func (*FileInformation) Sys

func (f *FileInformation) Sys() interface{}

Sys implements interface

type Options

type Options struct {
	ExcludePaths         []string
	DownloadExcludePaths []string
	UploadExcludePaths   []string

	UpstreamLimit   int64
	DownstreamLimit int64
	Verbose         bool

	DownloadOnInitialSync bool

	// These channels can be used to listen for certain sync events
	DownstreamInitialSyncDone chan bool
	UpstreamInitialSyncDone   chan bool
	SyncDone                  chan bool
	SyncError                 chan error

	Log log.Logger
}

Options holds the sync options

type Symlink struct {
	SymlinkPath string
	TargetPath  string

	IsDir bool
	// contains filtered or unexported fields
}

Symlink holds information about a symlink

func NewSymlink(upstream *upstream, symlinkPath, targetPath string, isDir bool) (*Symlink, error)

NewSymlink creates a new symlink object

func (*Symlink) Crawl

func (s *Symlink) Crawl() error

Crawl resolves the symlink and sends an event for each file in the target path

func (*Symlink) Stop

func (s *Symlink) Stop()

Stop stops watching on the watching path

type Sync

type Sync struct {
	LocalPath string
	Options   *Options
	// contains filtered or unexported fields
}

Sync holds the necessary information for the syncing process

func NewSync

func NewSync(localPath string, options *Options) (*Sync, error)

NewSync creates a new sync for the given

func (*Sync) Error

func (s *Sync) Error(err error)

Error handles a sync error

func (*Sync) InitDownstream

func (s *Sync) InitDownstream(reader io.ReadCloser, writer io.WriteCloser) error

InitDownstream inits the downstream

func (*Sync) InitUpstream

func (s *Sync) InitUpstream(reader io.ReadCloser, writer io.WriteCloser) error

InitUpstream inits the upstream

func (*Sync) Start

func (s *Sync) Start() error

Start starts a new sync instance

func (*Sync) Stop

func (s *Sync) Stop(fatalError error)

Stop stops the sync process

Jump to

Keyboard shortcuts

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