zsync

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 18 Imported by: 0

README

zsync

Zsync implementation in Golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sync

func Sync(local *os.File, output io.Writer, control control.Control, progressReporter ProgressReporter) (err error)

Types

type ChunkLookupSlice

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

func NewChunkLookupSlice

func NewChunkLookupSlice(file io.ReadSeeker, chunkSize int64, weakChecksum hash.Hash, strongChecksum hash.Hash) (*ChunkLookupSlice, error)

func (ChunkLookupSlice) GetStrongChecksum

func (s ChunkLookupSlice) GetStrongChecksum() []byte

func (ChunkLookupSlice) GetWeakChecksum

func (s ChunkLookupSlice) GetWeakChecksum() []byte

type ProgressReporter added in v0.1.2

type ProgressReporter interface {
	SetDescription(label string)
	SetProgress(value int64)
	SetTotal(value int64)

	Write(p []byte) (n int, err error)
}

func NewDummyProgressReporter added in v0.1.2

func NewDummyProgressReporter() ProgressReporter

type SyncData

type SyncData struct {
	control.Control

	WeakChecksumBuilder   hash.Hash
	StrongChecksumBuilder hash.Hash
	Local                 *os.File
	Output                io.Writer
	// contains filtered or unexported fields
}

func (*SyncData) AddMissingChunks

func (syncData *SyncData) AddMissingChunks(matchingChunks []chunks.ChunkInfo) (missing []chunks.ChunkInfo)

func (*SyncData) SearchAllMatchingChunks

func (syncData *SyncData) SearchAllMatchingChunks() ([]chunks.ChunkInfo, error)

type ZSync2 added in v0.1.3

type ZSync2 struct {
	BlockSize      int64
	ChecksumsIndex *index.ChecksumIndex

	RemoteFileUrl  string
	RemoteFileSize int64
}

func (*ZSync2) SearchReusableChunks added in v0.1.3

func (zsync *ZSync2) SearchReusableChunks(path string) (<-chan chunks.ChunkInfo, error)

func (*ZSync2) Sync added in v0.1.3

func (zsync *ZSync2) Sync(filePath string, output io.WriteSeeker) error

func (*ZSync2) WriteChunk added in v0.1.3

func (zsync *ZSync2) WriteChunk(source io.ReadSeeker, target io.WriteSeeker, chunk chunks.ChunkInfo) error

func (*ZSync2) WriteChunks added in v0.1.3

func (zsync *ZSync2) WriteChunks(source io.ReadSeeker, output io.WriteSeeker, chunkChannel <-chan chunks.ChunkInfo) error

Directories

Path Synopsis
Package chunks provides the basic structure for a pair of the weak and strong checksums.
Package chunks provides the basic structure for a pair of the weak and strong checksums.
package filechecksum provides the FileChecksumGenerator, whose main responsibility is to read a file, and generate both weak and strong checksums for every block.
package filechecksum provides the FileChecksumGenerator, whose main responsibility is to read a file, and generate both weak and strong checksums for every block.
Package index provides the functionality to describe a reference 'file' and its contents in terms of the weak and strong checksums, in such a way that you can check if a weak checksum is present, then check if there is a strong checksum that matches.
Package index provides the functionality to describe a reference 'file' and its contents in terms of the weak and strong checksums, in such a way that you can check if a weak checksum is present, then check if there is a strong checksum that matches.
rollsum provides an implementation of a rolling checksum - a checksum that's efficient to advance a byte or more at a time.
rollsum provides an implementation of a rolling checksum - a checksum that's efficient to advance a byte or more at a time.

Jump to

Keyboard shortcuts

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