Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var InProgress = errors.New("in progress")
InProgress indicates that the file is being transferred. It's a temporary condition, not an error.
Functions ¶
This section is empty.
Types ¶
type FileHook ¶
type FileHook func(fi os.FileInfo, op FileOperation, uploadedBytes *uint64, err error)
A FileHook is a function that is called with updates about a file transfer. uploadedBytes must be accessed using atomic.LoadUint64, if done outside the hook function.
type FileOperation ¶
type FileOperation rune
A FileOperation describes one of the transfer file operations.
const ( UnknownFileOperation FileOperation = '?' Create FileOperation = 'C' Remove FileOperation = 'R' Keep FileOperation = 'K' Update FileOperation = 'U' )
type ProcessStats ¶
type ProcessStats struct { InProgress uint32 SourceBytes uint64 SourceFiles uint64 SourceDirectories uint64 IgnoredFiles uint64 IgnoredDirectories uint64 FailedFiles uint64 FailedDirectories uint64 }
ProcessStats contains a snapshot of transfer process statistics.
func (*ProcessStats) CopyFrom ¶
func (ps *ProcessStats) CopyFrom(src *ProcessStats)
CopyFrom does atomic reads from source, and assigns to the receiver.
type Upload ¶
type Upload struct {
// contains filtered or unexported fields
}
An Upload contains information about an in-progress upload. While Run is executing, Stats can be used to get progress information.
func NewUpload ¶
func NewUpload(dest fs.WriteableFileSystem, src fs.ReadableFileSystem, opts ...UploadOpt) *Upload
NewUpload creates a new upload, with the given destination and source.
func (*Upload) Run ¶
Run performs a parallel file transfer. Only one Run should be executing for a process.
func (*Upload) Stats ¶
func (u *Upload) Stats() UploadStats
Stats returns statistics about the in-progress upload. This may be invoked while Run is executing.
type UploadOpt ¶
type UploadOpt func(*Upload)
An UploadOpt is an option to NewUpload.
func WithConcurrency ¶
WithConcurrency sets the transfer concurrency, in files.
func WithFileHook ¶
WithFileHook sets the per-file hook function. This is invoked when a file is starting transfer (with error set to InProgress), and when transfer has completed.
func WithGIDMap ¶
WithGIDMap sets a mapping from source GID to destination. By default, this is the identity function. The special value -1 can be both input and output, and means "current group".
func WithIgnoreFilter ¶
WithIgnoreFilter adds a filter function. If the function returns true for a file or directory, it will be completely ignored.
func WithUIDMap ¶
WithUIDMap sets a mapping from source UID to destination. By default, this is the identity function. The special value -1 can be both input and output, and means "current user".
type UploadStats ¶
type UploadStats struct { ProcessStats InodeTable uint32 UploadedBytes uint64 UploadedFiles uint64 CreatedDirectories uint64 UpdatedDirectories uint64 KeptBytes uint64 KeptFiles uint64 KeptDirectories uint64 RemovedFiles uint64 RemovedDirectories uint64 DiscardedFiles uint64 TransferRetries uint64 }
UploadStats contains a snapshot of upload statistics.