transfer

package
v0.5.14 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2017 License: Apache-2.0, BSD-3-Clause, MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FileToBlock Definition = "file-blockblob"
	HTTPToBlock            = "http-blockblob"
	BlobToFile             = "blob-file"
	FileToPage             = "file-pageblob"
	HTTPToPage             = "http-pageblob"
	HTTPToFile             = "http-file"
)

The different transfers types

View Source
const DupeCheckLevelStr = "None, ZeroOnly, Full" //TODO: package this better so it can stay in sync w/declaration

DupeCheckLevelStr list of duplicate blob check strategies

Variables

This section is empty.

Functions

This section is empty.

Types

type Channels

type Channels struct {
	ReadParts  chan pipeline.Part
	Parts      chan pipeline.Part
	Results    chan pipeline.WorkerResult
	Partitions chan pipeline.PartsPartition
}

Channels represents all the control channels in the transfer.

type Definition

type Definition string

Definition represents the supported source and target combinations

func ParseTransferDefinition

func ParseTransferDefinition(str string) (Definition, error)

ParseTransferDefinition parses a Definition from a string.

type DupeCheckLevel

type DupeCheckLevel int

DupeCheckLevel -- degree to which we'll try to check for duplicate blocks

const (
	None     DupeCheckLevel = iota // Don't bother to check
	ZeroOnly                       // Only check for blocks with all zero bytes
	Full                           // Compute MD5s and look for matches on that
)

The different levels for duplicate blocks

func ParseDupeCheckLevel

func ParseDupeCheckLevel(str string) (res DupeCheckLevel, err error)

ParseDupeCheckLevel converts string to DupeCheckLevel

func (*DupeCheckLevel) ToString

func (d *DupeCheckLevel) ToString() string

ToString printable representation of duplicate level values. For now, handle error as fatal, shouldn't be possible

type ProgressUpdate

type ProgressUpdate func(results pipeline.WorkerResult, committedCount int, bufferSize int)

ProgressUpdate called whenever a worker completes successfully

type StatInfo

type StatInfo struct {
	NumberOfFiles       int
	Duration            time.Duration
	TargetRetries       int32
	TotalNumberOfBlocks int
	TotalSize           uint64
	CumWriteDuration    time.Duration
}

StatInfo TODO

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

Stats TODO

func NewStats

func NewStats(numberOfWorkers int, numberOfReaders int) *Stats

NewStats TODO

func (*Stats) AddTransferInfo

func (t *Stats) AddTransferInfo(info *StatInfo)

AddTransferInfo TODO

func (*Stats) DisplaySummary

func (t *Stats) DisplaySummary()

DisplaySummary TODO

type TimeStatsInfo

type TimeStatsInfo struct {
	StartTime        time.Time
	Duration         time.Duration
	CumWriteDuration time.Duration
}

TimeStatsInfo contains transfer statistics, used at the end of the transfer

type Transfer

type Transfer struct {
	SourcePipeline   *pipeline.SourcePipeline
	TargetPipeline   *pipeline.TargetPipeline
	NumOfReaders     int
	NumOfWorkers     int
	TotalNumOfBlocks int
	TotalSize        uint64
	ThreadTarget     int
	SyncWaitGroups   *WaitGroups
	ControlChannels  *Channels
	TimeStats        *TimeStatsInfo
	// contains filtered or unexported fields
}

Transfer top data structure holding the state of the transfer.

func NewTransfer

func NewTransfer(source *pipeline.SourcePipeline, target *pipeline.TargetPipeline, readers int, workers int, blockSize uint64) *Transfer

NewTransfer creates a new Transfer, this will adjust the thread target and initialize the channels and the wait groups for the writers, readers and the committers

func (*Transfer) GetStats

func (t *Transfer) GetStats() *StatInfo

GetStats TODO

func (*Transfer) StartTransfer

func (t *Transfer) StartTransfer(dupeLevel DupeCheckLevel, progressBarDelegate ProgressUpdate)

StartTransfer starts the readers and readers. Process and commits the results of the write operations. The duration timer is started.

func (*Transfer) WaitForCompletion

func (t *Transfer) WaitForCompletion() (time.Duration, time.Duration)

WaitForCompletion blocks until the readers, writers and commit operations complete. Duration property is set and returned.

type WaitGroups

type WaitGroups struct {
	Readers sync.WaitGroup
	Workers sync.WaitGroup
	Commits sync.WaitGroup
}

WaitGroups holds all wait groups involved in the transfer.

type Worker

type Worker struct {
	WorkerID    int
	WorkerQueue chan pipeline.Part
	Result      chan pipeline.WorkerResult
	Wg          *sync.WaitGroup
	// contains filtered or unexported fields
}

Worker represents a worker routine that transfers data to a target

Jump to

Keyboard shortcuts

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