transfer

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFactory

func RegisterFactory(name model.ResourceType, factory Factory) error

RegisterFactory registers one transfer factory to the registry

Types

type Factory

type Factory func(Logger, StopFunc) (Transfer, error)

Factory creates a specific Transfer. The "Logger" is used to log the processing messages and the "StopFunc" can be used to check whether the task has been stopped during the processing progress

func GetFactory

func GetFactory(name model.ResourceType) (Factory, error)

GetFactory gets the transfer factory by the specified name

type Logger

type Logger interface {
	// For debuging
	Debug(v ...interface{})
	// For debuging with format
	Debugf(format string, v ...interface{})
	// For logging info
	Info(v ...interface{})
	// For logging info with format
	Infof(format string, v ...interface{})
	// For warning
	Warning(v ...interface{})
	// For warning with format
	Warningf(format string, v ...interface{})
	// For logging error
	Error(v ...interface{})
	// For logging error with format
	Errorf(format string, v ...interface{})
}

Logger defines an interface for logging

type StopFunc

type StopFunc func() bool

StopFunc is a function used to check whether the transfer process is stopped

type Transfer

type Transfer interface {
	Transfer(src *model.Resource, dst *model.Resource) error
}

Transfer defines an interface used to transfer the source resource to the destination

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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