proto

package
v0.0.0-...-f15d00b Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: Zlib Imports: 7 Imported by: 2

Documentation

Overview

A binary protocol for rsync.

Index

Constants

View Source
const (
	// Unique key written in every header to identify and confirm the stream.
	RsyncMagic uint32 = 0x72730136
)

Variables

View Source
var (
	ErrBadMagic           = errors.New("Corrupt or incorrect data: bad magic value in stream.")
	ErrUnknownCompression = errors.New("Unknown compression.")
	ErrInvalidCall        = errors.New("Cannot call function while reading from set type.")
	ErrHeaderOnce         = errors.New("Must call Header only once.")
	ErrBadVarintRead      = errors.New("Bad varint read.")
)

Functions

This section is empty.

Types

type Comp

type Comp byte
const (
	CompNone Comp = 0
	CompGZip Comp = 1
)

type ErrDataTooLong

type ErrDataTooLong int

func (ErrDataTooLong) Error

func (err ErrDataTooLong) Error() string

type ErrHashTooLong

type ErrHashTooLong int

func (ErrHashTooLong) Error

func (err ErrHashTooLong) Error() string

type ErrIncorrectType

type ErrIncorrectType struct {
	Expecting, Actual Type
}

func (ErrIncorrectType) Error

func (err ErrIncorrectType) Error() string

type Reader

type Reader struct {
	io.Reader
	// contains filtered or unexported fields
}

Initialize by setting the Reader. Call Header to initialize stream.

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Header

func (r *Reader) Header(t Type) (blockSize int, err error)

func (*Reader) ReadAllSignatures

func (r *Reader) ReadAllSignatures() ([]rsync.BlockHash, error)

func (*Reader) ReadOperations

func (r *Reader) ReadOperations(ops chan rsync.Operation, hashOps chan rsync.Operation) error

type Type

type Type byte
const (
	TypeSignature Type = 1
	TypeDelta     Type = 2
	TypePatch     Type = 3
)

type Writer

type Writer struct {
	io.Writer
	// contains filtered or unexported fields
}

Write the protocol to a stream by setting the Writer and calling its methods subsequently.

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Header

func (w *Writer) Header(t Type, compression Comp, blockSize int) error

The header must be written before any content may be written.

func (*Writer) OperationWriter

func (w *Writer) OperationWriter() rsync.OperationWriter

Return an operation writer. The call itself does not write anything. Use with a Delta header.

func (*Writer) SignatureWriter

func (w *Writer) SignatureWriter() rsync.SignatureWriter

Return a signature writer. The call itself does not write anything. Use with a Signature header.

Jump to

Keyboard shortcuts

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