transfer

package
v0.0.0-...-a548ab7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 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 string, 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 string) (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 Option

type Option func(*Options)

func WithCopyByChunk

func WithCopyByChunk(copyByChunk bool) Option

func WithSpeed

func WithSpeed(speed int32) Option

type Options

type Options struct {
	// Speed is the data transfer speed for replication, no limit by default.
	Speed int32
	// CopyByChunk defines whether need to copy the artifact blob by chunk, copy by whole blob by default.
	CopyByChunk bool
}

func NewOptions

func NewOptions(opts ...Option) *Options

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, opts *Options) 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