Documentation ¶
Overview ¶
Package receive implements a receiver for btrfs send streams.
Index ¶
- Variables
- func FindDiffOffset(streamA, streamB io.Reader) (offset uint64, err error)
- func FindPathDiffOffset(pathA, pathB string, pathAParent string, pathBParent string) (offset uint64, err error)
- func ProcessSendStream(r io.Reader, opts ...Option) error
- type Option
- func ForceDecompress() Option
- func FromOffset(offset uint64) Option
- func HonorEndCommand() Option
- func IgnoreChecksums() Option
- func To(rcvr receivers.Receiver) Option
- func WithContext(ctx context.Context) Option
- func WithLogger(logger *log.Logger, verbosity int) Option
- func WithMaxErrors(maxErrors int) Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidSendCommand is returned when an invalid send command is encountered. ErrInvalidSendCommand = errors.New("invalid send command") )
Functions ¶
func FindDiffOffset ¶
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 ¶
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.
Types ¶
type Option ¶
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 ¶
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 WithContext ¶
WithContext will set the context for the receiver to use. Defaults to a background context.
func WithLogger ¶
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 ¶
WithMaxErrors will set the maximum number of errors that can occur before the receiver stops processing the stream. Defaults to 1.
Directories ¶
Path | Synopsis |
---|---|
Package receivers exposes the interface for receiving data from a btrfs send stream.
|
Package receivers exposes the interface for receiving data from a btrfs send stream. |
directory
Package directory implements a receiver that receives snapshots into a directory, typically on a non-btrfs filesystem.
|
Package directory implements a receiver that receives snapshots into a directory, typically on a non-btrfs filesystem. |
dispatch
Package dispatch provides a receiver that dispatches to multiple receivers.
|
Package dispatch provides a receiver that dispatches to multiple receivers. |
local
Package local implements a receiver that writes the received data to a local btrfs filesystem.
|
Package local implements a receiver that writes the received data to a local btrfs filesystem. |
memfs
Package memfs implements a simple in-memory filesystem from a btrfs send stream.
|
Package memfs implements a simple in-memory filesystem from a btrfs send stream. |
nop
Package nop implements a receiver that does nothing.
|
Package nop implements a receiver that does nothing. |
sshdir
Package sshdir provides a receiver that can receive snapshots over ssh.
|
Package sshdir provides a receiver that can receive snapshots over ssh. |