Documentation
¶
Overview ¶
Pacakge sendstream implements a scanner for the btrfs send stream format.
Index ¶
- Constants
- Variables
- func NewChmodCommand(path string, mode uint64) (SendCommand, CmdAttrs)
- func NewChownCommand(path string, uid uint64, gid uint64) (SendCommand, CmdAttrs)
- func NewCloneCommand(path string, offset uint64, cloneLen uint64, cloneUUID uuid.UUID, ...) (SendCommand, CmdAttrs)
- func NewEnableVerityCommand(path string, alg uint8, blockSize uint32, salt []byte, sig []byte) (SendCommand, CmdAttrs)
- func NewEncodedWriteCommand(path string, op *btrfs.EncodedWriteOp) (SendCommand, CmdAttrs)
- func NewEndCommand() (SendCommand, CmdAttrs)
- func NewFallocateCommand(path string, mode uint32, offset uint64, size uint64) (SendCommand, CmdAttrs)
- func NewFileAttrCommand(path string, attr uint32) (SendCommand, CmdAttrs)
- func NewLinkCommand(path, link string) (SendCommand, CmdAttrs)
- func NewMkdirCommand(path string, ino uint64) (SendCommand, CmdAttrs)
- func NewMkfifoCommand(path string, ino uint64) (SendCommand, CmdAttrs)
- func NewMkfileCommand(path string, ino uint64) (SendCommand, CmdAttrs)
- func NewMknodCommand(path string, ino uint64, mode uint32, rdev uint64) (SendCommand, CmdAttrs)
- func NewMksockCommand(path string, ino uint64) (SendCommand, CmdAttrs)
- func NewRemoveXattrCommand(path string, name string) (SendCommand, CmdAttrs)
- func NewRenameCommand(path, pathTo string) (SendCommand, CmdAttrs)
- func NewRmdirCommand(path string) (SendCommand, CmdAttrs)
- func NewSetXattrCommand(path string, name string, data []byte) (SendCommand, CmdAttrs)
- func NewSnapshotCommand(path string, uu uuid.UUID, ctransid uint64, cloneUU uuid.UUID, ...) (SendCommand, CmdAttrs)
- func NewSubvolCommand(path string, uu uuid.UUID, ctransid uint64) (SendCommand, CmdAttrs)
- func NewSymlinkCommand(path, link string, ino uint64) (SendCommand, CmdAttrs)
- func NewTruncateCommand(path string, size uint64) (SendCommand, CmdAttrs)
- func NewUnlinkCommand(path string) (SendCommand, CmdAttrs)
- func NewUpdateExtentCommand(path string, offset uint64, size uint64) (SendCommand, CmdAttrs)
- func NewUtimesCommand(path string, atime, mtime, ctime time.Time) (SendCommand, CmdAttrs)
- func NewWriteCommand(path string, offset uint64, data []byte) (SendCommand, CmdAttrs)
- type CmdAttrs
- func (c CmdAttrs) BinarySize() uint32
- func (c CmdAttrs) Encode() ([]byte, error)
- func (c CmdAttrs) GetAtime() (time.Time, error)
- func (c CmdAttrs) GetCloneCTransid() uint64
- func (c CmdAttrs) GetCloneCtransid() uint64
- func (c CmdAttrs) GetCloneLen() uint64
- func (c CmdAttrs) GetCloneOffset() uint64
- func (c CmdAttrs) GetClonePath() string
- func (c CmdAttrs) GetCloneUUID() (uuid.UUID, error)
- func (c CmdAttrs) GetCompressionType() btrfs.CompressionType
- func (c CmdAttrs) GetCtime() (time.Time, error)
- func (c CmdAttrs) GetCtransid() uint64
- func (c CmdAttrs) GetData() []byte
- func (c CmdAttrs) GetEncryptionType() uint32
- func (c CmdAttrs) GetFallocateMode() uint32
- func (c CmdAttrs) GetFileAttr() uint32
- func (c CmdAttrs) GetFileOffset() uint64
- func (c CmdAttrs) GetGid() uint64
- func (c CmdAttrs) GetIno() uint64
- func (c CmdAttrs) GetMode32() uint32
- func (c CmdAttrs) GetMode64() uint64
- func (c CmdAttrs) GetMtime() (time.Time, error)
- func (c CmdAttrs) GetOtime() (time.Time, error)
- func (c CmdAttrs) GetPath() string
- func (c CmdAttrs) GetPathLink() string
- func (c CmdAttrs) GetPathTo() string
- func (c CmdAttrs) GetRdev() uint64
- func (c CmdAttrs) GetSize() uint64
- func (c CmdAttrs) GetUUID() (uuid.UUID, error)
- func (c CmdAttrs) GetUid() uint64
- func (c CmdAttrs) GetUnencodedFileLen() uint64
- func (c CmdAttrs) GetUnencodedLen() uint64
- func (c CmdAttrs) GetUnencodedOffset() uint64
- func (c CmdAttrs) GetVerityAlgorithm() uint8
- func (c CmdAttrs) GetVerityBlockSize() uint32
- func (c CmdAttrs) GetVeritySalt() []byte
- func (c CmdAttrs) GetVeritySig() []byte
- func (c CmdAttrs) GetXattrData() []byte
- func (c CmdAttrs) GetXattrName() string
- func (c CmdAttrs) SetAtime(atime time.Time)
- func (c CmdAttrs) SetCloneCTransid(ctransid uint64)
- func (c CmdAttrs) SetCloneCtransid(ctransid uint64)
- func (c CmdAttrs) SetCloneLen(len uint64)
- func (c CmdAttrs) SetCloneOffset(off uint64)
- func (c CmdAttrs) SetClonePath(path string)
- func (c CmdAttrs) SetCloneUUID(uuid uuid.UUID)
- func (c CmdAttrs) SetCompressionType(ct btrfs.CompressionType)
- func (c CmdAttrs) SetCtime(ctime time.Time)
- func (c CmdAttrs) SetCtransid(ctransid uint64)
- func (c CmdAttrs) SetData(bb []byte)
- func (c CmdAttrs) SetEncryptionType(et uint32)
- func (c CmdAttrs) SetFallocateMode(mode uint32)
- func (c CmdAttrs) SetFileAttr(fileattr uint32)
- func (c CmdAttrs) SetFileOffset(off uint64)
- func (c CmdAttrs) SetGid(gid uint64)
- func (c CmdAttrs) SetIno(ino uint64)
- func (c CmdAttrs) SetMode32(mode uint32)
- func (c CmdAttrs) SetMode64(mode uint64)
- func (c CmdAttrs) SetMtime(mtime time.Time)
- func (c CmdAttrs) SetOtime(otime time.Time)
- func (c CmdAttrs) SetPath(path string)
- func (c CmdAttrs) SetPathLink(path string)
- func (c CmdAttrs) SetPathTo(path string)
- func (c CmdAttrs) SetRdev(rdev uint64)
- func (c CmdAttrs) SetSize(size uint64)
- func (c CmdAttrs) SetUUID(uuid uuid.UUID)
- func (c CmdAttrs) SetUid(uid uint64)
- func (c CmdAttrs) SetUnencodedFileLen(len uint64)
- func (c CmdAttrs) SetUnencodedLen(len uint64)
- func (c CmdAttrs) SetUnencodedOffset(off uint64)
- func (c CmdAttrs) SetVerityAlgorithm(algorithm uint8)
- func (c CmdAttrs) SetVerityBlockSize(blockSize uint32)
- func (c CmdAttrs) SetVeritySalt(salt []byte)
- func (c CmdAttrs) SetVeritySig(sig []byte)
- func (c CmdAttrs) SetXattrData(data []byte)
- func (c CmdAttrs) SetXattrName(name string)
- type CmdHeader
- type ReceivingSubvolume
- type Scanner
- type SendAttribute
- type SendCommand
- type StreamHeader
- type Writer
Constants ¶
const ( BTRFS_SEND_STREAM_MAGIC = "btrfs-stream\x00" BTRFS_SEND_STREAM_VERSION uint32 = 2 )
Variables ¶
var ( ErrInvalidMagic = errors.New("invalid magic") ErrInvalidVersion = errors.New("invalid version") ErrHeaderAlreadyParsed = errors.New("header already parsed") ErrInvalidCommandChecksum = errors.New("invalid crc32 checksum for command") )
var ( BTRFS_SEND_STREAM_MAGIC_ENCODED [13]byte = func() [13]byte { var arr [13]byte copy(arr[:], BTRFS_SEND_STREAM_MAGIC) return arr }() )
var ErrHeaderAlreadySent = fmt.Errorf("header already sent")
Functions ¶
func NewChmodCommand ¶ added in v0.0.8
func NewChmodCommand(path string, mode uint64) (SendCommand, CmdAttrs)
NewChmodCommand creates a new chmod command.
func NewChownCommand ¶ added in v0.0.8
func NewChownCommand(path string, uid uint64, gid uint64) (SendCommand, CmdAttrs)
NewChownCommand creates a new chown command.
func NewCloneCommand ¶ added in v0.0.8
func NewCloneCommand( path string, offset uint64, cloneLen uint64, cloneUUID uuid.UUID, cloneCtransid uint64, clonePath string, cloneOffset uint64, ) (SendCommand, CmdAttrs)
NewCloneCommand creates a new clone command.
func NewEnableVerityCommand ¶ added in v0.0.8
func NewEnableVerityCommand(path string, alg uint8, blockSize uint32, salt []byte, sig []byte) (SendCommand, CmdAttrs)
NewEnableVerityCommand creates a new enable verity command.
func NewEncodedWriteCommand ¶ added in v0.0.8
func NewEncodedWriteCommand(path string, op *btrfs.EncodedWriteOp) (SendCommand, CmdAttrs)
NewEncodedWriteCommand creates a new encoded write command. This will only work on target btrfs filesystems that support compression.
func NewEndCommand ¶ added in v0.0.8
func NewEndCommand() (SendCommand, CmdAttrs)
NewEndCommand creates a new end command.
func NewFallocateCommand ¶ added in v0.0.8
func NewFallocateCommand(path string, mode uint32, offset uint64, size uint64) (SendCommand, CmdAttrs)
NewFallocateCommand creates a new fallocate command.
func NewFileAttrCommand ¶ added in v0.0.8
func NewFileAttrCommand(path string, attr uint32) (SendCommand, CmdAttrs)
NewFileAttrCommand creates a new file-attr command.
func NewLinkCommand ¶ added in v0.0.8
func NewLinkCommand(path, link string) (SendCommand, CmdAttrs)
NewLinkCommand creates a new link command.
func NewMkdirCommand ¶ added in v0.0.8
func NewMkdirCommand(path string, ino uint64) (SendCommand, CmdAttrs)
NewMkdirCommand creates a new mkdir command.
func NewMkfifoCommand ¶ added in v0.0.8
func NewMkfifoCommand(path string, ino uint64) (SendCommand, CmdAttrs)
NewMkfifoCommand creates a new mkfifo command.
func NewMkfileCommand ¶ added in v0.0.8
func NewMkfileCommand(path string, ino uint64) (SendCommand, CmdAttrs)
NewMkfileCommand creates a new mkfile command.
func NewMknodCommand ¶ added in v0.0.8
NewMknodCommand creates a new mknod command.
func NewMksockCommand ¶ added in v0.0.8
func NewMksockCommand(path string, ino uint64) (SendCommand, CmdAttrs)
NewMksockCommand creates a new mksock command.
func NewRemoveXattrCommand ¶ added in v0.0.8
func NewRemoveXattrCommand(path string, name string) (SendCommand, CmdAttrs)
NewRemoveXattrCommand creates a new remove-xattr command.
func NewRenameCommand ¶ added in v0.0.8
func NewRenameCommand(path, pathTo string) (SendCommand, CmdAttrs)
NewRenameCommand creates a new rename command.
func NewRmdirCommand ¶ added in v0.0.8
func NewRmdirCommand(path string) (SendCommand, CmdAttrs)
NewRmdirCommand creates a new rmdir command.
func NewSetXattrCommand ¶ added in v0.0.8
func NewSetXattrCommand(path string, name string, data []byte) (SendCommand, CmdAttrs)
NewSetXattrCommand creates a new set-xattr command.
func NewSnapshotCommand ¶ added in v0.0.8
func NewSnapshotCommand(path string, uu uuid.UUID, ctransid uint64, cloneUU uuid.UUID, cloneCtransid uint64) (SendCommand, CmdAttrs)
NewSnapshotCommand creates a new snapshot command. Most streams will need to begin with either this or a subvolume command.
func NewSubvolCommand ¶ added in v0.0.8
NewSubvolCommand creates a new subvolume command. Most streams will need to begin with either this or a snapshot command.
func NewSymlinkCommand ¶ added in v0.0.8
func NewSymlinkCommand(path, link string, ino uint64) (SendCommand, CmdAttrs)
NewSymlinkCommand creates a new symlink command.
func NewTruncateCommand ¶ added in v0.0.8
func NewTruncateCommand(path string, size uint64) (SendCommand, CmdAttrs)
NewTruncateCommand creates a new truncate command.
func NewUnlinkCommand ¶ added in v0.0.8
func NewUnlinkCommand(path string) (SendCommand, CmdAttrs)
NewUnlinkCommand creates a new unlink command.
func NewUpdateExtentCommand ¶ added in v0.0.8
func NewUpdateExtentCommand(path string, offset uint64, size uint64) (SendCommand, CmdAttrs)
NewUpdateExtentCommand creates a new update extent command.
func NewUtimesCommand ¶ added in v0.0.8
func NewUtimesCommand(path string, atime, mtime, ctime time.Time) (SendCommand, CmdAttrs)
NewUtimesCommand creates a new utimes command.
func NewWriteCommand ¶ added in v0.0.8
func NewWriteCommand(path string, offset uint64, data []byte) (SendCommand, CmdAttrs)
NewWriteCommand creates a new write command.
Types ¶
type CmdAttrs ¶
type CmdAttrs map[SendAttribute][]byte
func NewCmdAttrs ¶ added in v0.0.8
func NewCmdAttrs() CmdAttrs
NewCmdAttrs allocates a new CmdAttrs map.
func (CmdAttrs) BinarySize ¶ added in v0.0.8
BinarySize returns the encoded length of the command attributes to be included in a command header.
func (CmdAttrs) GetCloneCTransid ¶ added in v0.0.6
func (CmdAttrs) GetCloneCtransid ¶ added in v0.0.6
func (CmdAttrs) GetCloneLen ¶ added in v0.0.6
func (CmdAttrs) GetCloneOffset ¶ added in v0.0.6
func (CmdAttrs) GetClonePath ¶ added in v0.0.6
func (CmdAttrs) GetCompressionType ¶ added in v0.0.6
func (c CmdAttrs) GetCompressionType() btrfs.CompressionType
func (CmdAttrs) GetCtransid ¶ added in v0.0.6
func (CmdAttrs) GetEncryptionType ¶ added in v0.0.6
func (CmdAttrs) GetFallocateMode ¶ added in v0.0.6
func (CmdAttrs) GetFileAttr ¶ added in v0.0.8
func (CmdAttrs) GetFileOffset ¶ added in v0.0.6
func (CmdAttrs) GetPathLink ¶ added in v0.0.6
func (CmdAttrs) GetUnencodedFileLen ¶ added in v0.0.6
func (CmdAttrs) GetUnencodedLen ¶ added in v0.0.6
func (CmdAttrs) GetUnencodedOffset ¶ added in v0.0.6
func (CmdAttrs) GetVerityAlgorithm ¶ added in v0.0.6
func (CmdAttrs) GetVerityBlockSize ¶ added in v0.0.6
func (CmdAttrs) GetVeritySalt ¶ added in v0.0.6
func (CmdAttrs) GetVeritySig ¶ added in v0.0.6
func (CmdAttrs) GetXattrData ¶ added in v0.0.6
func (CmdAttrs) GetXattrName ¶ added in v0.0.6
func (CmdAttrs) SetCloneCTransid ¶ added in v0.0.8
func (CmdAttrs) SetCloneCtransid ¶ added in v0.0.8
func (CmdAttrs) SetCloneLen ¶ added in v0.0.8
func (CmdAttrs) SetCloneOffset ¶ added in v0.0.8
func (CmdAttrs) SetClonePath ¶ added in v0.0.8
func (CmdAttrs) SetCloneUUID ¶ added in v0.0.8
func (CmdAttrs) SetCompressionType ¶ added in v0.0.8
func (c CmdAttrs) SetCompressionType(ct btrfs.CompressionType)
func (CmdAttrs) SetCtransid ¶ added in v0.0.8
func (CmdAttrs) SetEncryptionType ¶ added in v0.0.8
func (CmdAttrs) SetFallocateMode ¶ added in v0.0.8
func (CmdAttrs) SetFileAttr ¶ added in v0.0.8
func (CmdAttrs) SetFileOffset ¶ added in v0.0.8
func (CmdAttrs) SetPathLink ¶ added in v0.0.8
func (CmdAttrs) SetUnencodedFileLen ¶ added in v0.0.8
func (CmdAttrs) SetUnencodedLen ¶ added in v0.0.8
func (CmdAttrs) SetUnencodedOffset ¶ added in v0.0.8
func (CmdAttrs) SetVerityAlgorithm ¶ added in v0.0.8
func (CmdAttrs) SetVerityBlockSize ¶ added in v0.0.8
func (CmdAttrs) SetVeritySalt ¶ added in v0.0.8
func (CmdAttrs) SetVeritySig ¶ added in v0.0.8
func (CmdAttrs) SetXattrData ¶ added in v0.0.8
func (CmdAttrs) SetXattrName ¶ added in v0.0.8
type CmdHeader ¶
type CmdHeader struct {
Len uint32
Cmd SendCommand
Crc uint32
}
type ReceivingSubvolume ¶ added in v0.0.7
type ReceivingSubvolume struct {
// The path of the subvolume
Path string
// The UUID of the subvolume
UUID uuid.UUID
// The ctransid of the subvolume
Ctransid uint64
}
func (*ReceivingSubvolume) ResolvePath ¶ added in v0.0.7
func (r *ReceivingSubvolume) ResolvePath(path string) string
type Scanner ¶
Scanner is a send stream scanner. It reads a send stream from an io.Reader and parses it into commands. It is not safe for concurrent use.
func NewScanner ¶
NewScanner returns a new Scanner that reads from r. If ignoreChecksums is true, the scanner will ignore crc32 checksum errors.
func (*Scanner) Err ¶
Err returns the first non-EOF/non-END error that was encountered by the Scanner.
func (*Scanner) ReadCommand ¶
ReadCommand reads the next command from r.
func (*Scanner) ReadHeader ¶
func (s *Scanner) ReadHeader(validate bool) (StreamHeader, error)
ReadHeader reads the stream header from r. It returns an error if the header is invalid or has already been parsed. If validate is false, the magic and version are not validated.
func (*Scanner) Scan ¶
Scan advances the scanner to the next command. It returns false when the scan stops, either by reaching the end of the input or an error. After Scan returns false, the Err method will return any error that occurred during scanning, except that if it was io.EOF after an END command, Err will return nil. If the header has not been parsed yet, Scan will parse it before reading the first command.
type SendAttribute ¶
type SendAttribute uint16
const ( BTRFS_SEND_A_UNSPEC SendAttribute = 0 /* Version 1 */ BTRFS_SEND_A_UUID SendAttribute = 1 BTRFS_SEND_A_CTRANSID SendAttribute = 2 BTRFS_SEND_A_INO SendAttribute = 3 BTRFS_SEND_A_SIZE SendAttribute = 4 BTRFS_SEND_A_MODE SendAttribute = 5 BTRFS_SEND_A_UID SendAttribute = 6 BTRFS_SEND_A_GID SendAttribute = 7 BTRFS_SEND_A_RDEV SendAttribute = 8 BTRFS_SEND_A_CTIME SendAttribute = 9 BTRFS_SEND_A_MTIME SendAttribute = 10 BTRFS_SEND_A_ATIME SendAttribute = 11 BTRFS_SEND_A_OTIME SendAttribute = 12 BTRFS_SEND_A_XATTR_NAME SendAttribute = 13 BTRFS_SEND_A_XATTR_DATA SendAttribute = 14 BTRFS_SEND_A_PATH SendAttribute = 15 BTRFS_SEND_A_PATH_TO SendAttribute = 16 BTRFS_SEND_A_PATH_LINK SendAttribute = 17 BTRFS_SEND_A_FILE_OFFSET SendAttribute = 18 /* * As of send stream v2, this attribute is special: it must be the last * attribute in a command, its header contains only the type, and its * length is implicitly the remaining length of the command. */ BTRFS_SEND_A_DATA SendAttribute = 19 BTRFS_SEND_A_CLONE_UUID SendAttribute = 20 BTRFS_SEND_A_CLONE_CTRANSID SendAttribute = 21 BTRFS_SEND_A_CLONE_PATH SendAttribute = 22 BTRFS_SEND_A_CLONE_OFFSET SendAttribute = 23 BTRFS_SEND_A_CLONE_LEN SendAttribute = 24 BTRFS_SEND_A_MAX_V1 SendAttribute = 24 /* Version 2 */ BTRFS_SEND_A_FALLOCATE_MODE SendAttribute = 25 /* * File attributes from the FS_*_FL namespace (i_flags, xflags), * translated to BTRFS_INODE_* bits (BTRFS_INODE_FLAG_MASK) and stored * in btrfs_inode_item::flags (represented by btrfs_inode::flags and * btrfs_inode::ro_flags). */ BTRFS_SEND_A_FILEATTR SendAttribute = 26 BTRFS_SEND_A_UNENCODED_FILE_LEN SendAttribute = 27 BTRFS_SEND_A_UNENCODED_LEN SendAttribute = 28 BTRFS_SEND_A_UNENCODED_OFFSET SendAttribute = 29 /* * COMPRESSION and ENCRYPTION default to NONE (0) if omitted from * BTRFS_SEND_C_ENCODED_WRITE. */ BTRFS_SEND_A_COMPRESSION SendAttribute = 30 BTRFS_SEND_A_ENCRYPTION SendAttribute = 31 BTRFS_SEND_A_MAX_V2 SendAttribute = 31 /* Version 3 */ BTRFS_SEND_A_VERITY_ALGORITHM SendAttribute = 32 BTRFS_SEND_A_VERITY_BLOCK_SIZE SendAttribute = 33 BTRFS_SEND_A_VERITY_SALT_DATA SendAttribute = 34 BTRFS_SEND_A_VERITY_SIG_DATA SendAttribute = 35 BTRFS_SEND_A_MAX_V3 SendAttribute = 35 /* End */ BTRFS_SEND_A_MAX SendAttribute = 35 )
func (SendAttribute) String ¶
func (i SendAttribute) String() string
type SendCommand ¶
type SendCommand uint16
const ( BTRFS_SEND_C_UNSPEC SendCommand = 0 /* Version 1 */ BTRFS_SEND_C_SUBVOL SendCommand = 1 BTRFS_SEND_C_SNAPSHOT SendCommand = 2 BTRFS_SEND_C_MKFILE SendCommand = 3 BTRFS_SEND_C_MKDIR SendCommand = 4 BTRFS_SEND_C_MKNOD SendCommand = 5 BTRFS_SEND_C_MKFIFO SendCommand = 6 BTRFS_SEND_C_MKSOCK SendCommand = 7 BTRFS_SEND_C_SYMLINK SendCommand = 8 BTRFS_SEND_C_RENAME SendCommand = 9 BTRFS_SEND_C_LINK SendCommand = 10 BTRFS_SEND_C_UNLINK SendCommand = 11 BTRFS_SEND_C_RMDIR SendCommand = 12 BTRFS_SEND_C_SET_XATTR SendCommand = 13 BTRFS_SEND_C_REMOVE_XATTR SendCommand = 14 BTRFS_SEND_C_WRITE SendCommand = 15 BTRFS_SEND_C_CLONE SendCommand = 16 BTRFS_SEND_C_TRUNCATE SendCommand = 17 BTRFS_SEND_C_CHMOD SendCommand = 18 BTRFS_SEND_C_CHOWN SendCommand = 19 BTRFS_SEND_C_UTIMES SendCommand = 20 BTRFS_SEND_C_END SendCommand = 21 BTRFS_SEND_C_UPDATE_EXTENT SendCommand = 22 BTRFS_SEND_C_MAX_V1 SendCommand = 22 /* Version 2 */ BTRFS_SEND_C_FALLOCATE SendCommand = 23 BTRFS_SEND_C_FILEATTR SendCommand = 24 BTRFS_SEND_C_ENCODED_WRITE SendCommand = 25 BTRFS_SEND_C_MAX_V2 SendCommand = 25 BTRFS_SEND_C_ENABLE_VERITY SendCommand = 26 BTRFS_SEND_C_MAX_V3 SendCommand = 26 /* End */ BTRFS_SEND_C_MAX SendCommand = 26 )
func (SendCommand) String ¶
func (i SendCommand) String() string
type StreamHeader ¶
type Writer ¶ added in v0.0.8
Writer is a wrapper around io.Writer that writes btrfs send stream commands to the receiving end.
func (*Writer) End ¶ added in v0.0.8
End sends the END command to the receiving end. If the header has not been sent yet, it will be sent first. This does not block further commands from being sent to the receiving end, since it is possible to send multiple streams to the same receiving end.
func (*Writer) SendHeader ¶ added in v0.0.8
SendHeader writes the btrfs send stream header to the receiving end. If the header was already sent, ErrHeaderAlreadySent is returned.
func (*Writer) WriteCommand ¶ added in v0.0.8
func (w *Writer) WriteCommand(cmd SendCommand, attrs CmdAttrs) error
WriteCommand writes a command to the receiving end. If the header has not been sent yet, it will be sent first. Commands can be created using the New*Command functions.