blockrsync

package
v0.0.0-...-55948b5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hole byte = iota
	Block
)
View Source
const (
	FALLOC_FL_KEEP_SIZE  = 0x01 /* default is extend size */
	FALLOC_FL_PUNCH_HOLE = 0x02 /* de-allocates range */
)
View Source
const (
	DefaultBlockSize = int64(64 * 1024)
)

Variables

View Source
var (
	ErrPunchHoleNotSupported = errors.New("this filesystem does not support punching holes. Use xfs, ext4, btrfs or such")
)

Functions

func PunchHole

func PunchHole(f *os.File, offset, size int64) error

Types

type BlockReader

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

func NewBlockReader

func NewBlockReader(source io.Reader, blockSize int, log logr.Logger) *BlockReader

func (*BlockReader) Block

func (b *BlockReader) Block() []byte

func (*BlockReader) IsHole

func (b *BlockReader) IsHole() bool

func (*BlockReader) Next

func (b *BlockReader) Next() (bool, error)

func (*BlockReader) Offset

func (b *BlockReader) Offset() int64

type BlockRsyncOptions

type BlockRsyncOptions struct {
	Preallocation bool
	BlockSize     int
}

type BlockrsyncClient

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

func NewBlockrsyncClient

func NewBlockrsyncClient(sourceFile, targetAddress string, port int, opts *BlockRsyncOptions, logger logr.Logger) *BlockrsyncClient

func (*BlockrsyncClient) ConnectToTarget

func (b *BlockrsyncClient) ConnectToTarget() error

type BlockrsyncServer

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

func NewBlockrsyncServer

func NewBlockrsyncServer(targetFile string, port int, opts *BlockRsyncOptions, logger logr.Logger) *BlockrsyncServer

func (*BlockrsyncServer) StartServer

func (b *BlockrsyncServer) StartServer() error

type ConnectionProvider

type ConnectionProvider interface {
	Connect() (io.ReadWriteCloser, error)
}

type FileHasher

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

func (*FileHasher) BlockSize

func (f *FileHasher) BlockSize() int64

func (*FileHasher) DeserializeHashes

func (f *FileHasher) DeserializeHashes(r io.Reader) (int64, map[int64][]byte, error)

func (*FileHasher) DiffHashes

func (f *FileHasher) DiffHashes(blockSize int64, cmpHash map[int64][]byte) ([]int64, error)

func (*FileHasher) GetHashes

func (f *FileHasher) GetHashes() map[int64][]byte

func (*FileHasher) HashFile

func (f *FileHasher) HashFile(fileName string) (int64, error)

func (*FileHasher) SerializeHashes

func (f *FileHasher) SerializeHashes(w io.Writer) error

type Hasher

type Hasher interface {
	HashFile(file string) (int64, error)
	GetHashes() map[int64][]byte
	DiffHashes(int64, map[int64][]byte) ([]int64, error)
	SerializeHashes(io.Writer) error
	DeserializeHashes(io.Reader) (int64, map[int64][]byte, error)
	BlockSize() int64
}

func NewFileHasher

func NewFileHasher(blockSize int64, log logr.Logger) Hasher

type NetworkConnectionProvider

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

func (*NetworkConnectionProvider) Connect

type OffsetHash

type OffsetHash struct {
	Offset int64
	Hash   []byte
}

type Progress

type Progress interface {
	Start(size int64)
	Update(pos int64)
}

Jump to

Keyboard shortcuts

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