receive

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: LGPL-3.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSendCommand is returned when an invalid send command is encountered.
	ErrInvalidSendCommand = errors.New("invalid send command")
)

Functions

func FindDiffOffset added in v0.0.4

func FindDiffOffset(streamA, streamB io.Reader) (offset uint64, err error)

FindDiffOffset will find the offset in the stream where the diff between the two streams begins. This is useful for determining where to resume a stream that has been interrupted. It is recommended to pass streams sent with the SendWithoutData flag to this function.

func FindPathDiffOffset added in v0.0.4

func FindPathDiffOffset(pathA, pathB string, pathAParent string, pathBParent string) (offset uint64, err error)

FindPathDiffOffset is the same as FindDiffOffset but will initiate the stream from the given paths. This is useful for ensuring that the source paths are read-only before attempting to find the diff offset and that the recommended flags are passed to the send stream.

func ProcessSendStream

func ProcessSendStream(r io.Reader, opts ...Option) error

ProcessSendStream will process a send stream and apply it to the receiver with the given options.

Types

type Option added in v0.0.4

type Option func(*receiveCtx) error

Option is a function that can be passed to ProcessSendStream to configure the behavior of the receiver.

func ForceDecompress

func ForceDecompress() Option

ForceDecompress will cause the receiver to decompress any compressed data it encounters in the stream. This is useful if the stream is compressed but the receiver does not support compression.

func FromOffset added in v0.0.4

func FromOffset(offset uint64) Option

FromOffset will start processing the stream at the given command offset. This is useful if you want to resume a stream that was interrupted.

func HonorEndCommand

func HonorEndCommand() Option

HonorEndCommand will cause the receiver to stop processing the stream when it encounters a BTRFS_SEND_C_END command.

func IgnoreChecksums

func IgnoreChecksums() Option

IgnoreChecksums will cause the receiver to ignore crc32 checksums in the stream. This has no effect on IncrementAgainst.

func To

func To(rcvr receivers.Receiver) Option

To will set the receiver to use for the stream. Defaults to a nop receiver.

func WithContext

func WithContext(ctx context.Context) Option

WithContext will set the context for the receiver to use. Defaults to a background context.

func WithLogger

func WithLogger(logger *log.Logger, verbosity int) Option

WithLogger will set the logger for the receiver to use. Defaults to a logger that discards all output. Increasing the verbosity will cause the logger to print more information about the processing of the stream.

func WithMaxErrors

func WithMaxErrors(maxErrors int) Option

WithMaxErrors will set the maximum number of errors that can occur before the receiver stops processing the stream. Defaults to 1.

Directories

Path Synopsis
nop

Jump to

Keyboard shortcuts

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