file_helper

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CHUNK_SIZE int64 = 512 * 1024
)

Variables

View Source
var (
	ErrInvalidArgument = errors.New("invalid argument")
	ErrHashNotMatch    = errors.New("hash not match")
	ErrBadChunkIndex   = errors.New("bad chunk index")
	ErrEmptyCacheFile  = errors.New("empty cache file")
)
View Source
var (
	DONE = errors.New("done")
)

Functions

This section is empty.

Types

type FileSyncer

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

func NewFileSyncer

func NewFileSyncer(opts ...SetFileSyncerOption) (*FileSyncer, error)

func (*FileSyncer) Close

func (fs *FileSyncer) Close() (err error)

func (*FileSyncer) Initialize

func (fs *FileSyncer) Initialize() error

func (*FileSyncer) Next

func (fs *FileSyncer) Next(batch int) (offsets []int64, err error)

func (*FileSyncer) Sync

func (fs *FileSyncer) Sync(offset int64, data []byte, size int) (err error)

func (*FileSyncer) Validate

func (fs *FileSyncer) Validate() error

type FileSyncerOption

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

func NewFileSyncerOption

func NewFileSyncerOption() *FileSyncerOption

type SetFileSyncerOption

type SetFileSyncerOption func(*FileSyncerOption)

func SetCachePath

func SetCachePath(path string) SetFileSyncerOption

func SetChunkSize

func SetChunkSize(size int64) SetFileSyncerOption

func SetPath

func SetPath(path string) SetFileSyncerOption

func SetSha1Hash

func SetSha1Hash(hash string) SetFileSyncerOption

func SetSize

func SetSize(size int64) SetFileSyncerOption

Jump to

Keyboard shortcuts

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