Documentation ¶
Overview ¶
Package xbstream provides support for reading and writing xbstream archives
xbstream is archive formatted created by Percona as part of their XtraBackup software suite. The xbstream archive format is their replacement for tar, and unlike tar allows for parallel streams of files to be written to the archive concurrently.
The implementation found in this package is closely modeled from the original C source code, and aims to be interoperable.
Index ¶
Constants ¶
const ( // MinimumChunkSize represents the smallest chunk size that xbstream will attempt to fill before flushing to the stream MinimumChunkSize = 10 * 1024 * 1024 // MaxPathLength is the largest file path that can exist within an xbstream archive MaxPathLength = 512 // FlagChunkIgnorable indicates a chunk as ignorable FlagChunkIgnorable ChunkFlag = 0x01 )
const ( // ChunkTypePayload indicates chunk contains file payload ChunkTypePayload = ChunkType('P') // ChunkTypeEOF indicates chunk is the eof marker for a file ChunkTypeEOF = ChunkType('E') // ChunkTypeUnknown indicates the chunk was a type that was unknown to xbstream ChunkTypeUnknown = ChunkType(0) )
Variables ¶
var ( // ErrStreamRead indicates an error occurred while parsing an xbstream ErrStreamRead = errors.New("xbstream read error") )
Functions ¶
This section is empty.
Types ¶
type Chunk ¶
type Chunk struct { ChunkHeader io.Reader }
Chunk encapsulates a ChunkHeader and provides a io.Reader interface for reading the payload described by the Header
type ChunkHeader ¶
type ChunkHeader struct { Magic []uint8 Flags ChunkFlag Type ChunkType // The type of Chunk, Note xbstream archives end with a specific EOF type PathLen uint32 Path []uint8 PayLen uint64 PayOffset uint64 Checksum uint32 }
ChunkHeader contains the metadata regarding the payload that immediately follows within the archive
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a file that is stored within the archive. Exposes an io.WriteCloser interface
func (*File) Close ¶
Close flushes any buffered content and closes the file by writing the EOF chunk to the archive
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader provides sequential access to chunks from an xbstream. Each chunk returned represents a contiguous set of bytes for a file stored in the xbstream archive. The Next method advances the stream and returns the next chunk in the archive. Each archive then acts as a reader for its contiguous set of bytes