Documentation
¶
Overview ¶
Package catalog encodes the Proxmox .pcat1 catalog format used alongside PXAR v1 archives. Catalogs are written bottom-up (children's tables before their parents) so directory entries can reference child tables by backward delta, and terminated by a root pointer trailer (fixed little-endian u64).
PXAR v2 split archives do not use a catalog; the metadata stream serves that role.
Index ¶
- Constants
- Variables
- type Entry
- type Writer
- func (c *Writer) AddBlockDevice(name string) error
- func (c *Writer) AddCharDevice(name string) error
- func (c *Writer) AddFifo(name string) error
- func (c *Writer) AddFile(name string, size uint64, mtimeSecs int64) error
- func (c *Writer) AddHardlink(name string) error
- func (c *Writer) AddSocket(name string) error
- func (c *Writer) AddSymlink(name string) error
- func (c *Writer) EndDirectory() error
- func (c *Writer) Finish() error
- func (c *Writer) StartDirectory(name string) error
Constants ¶
const ( TypeDirectory = 'd' TypeFile = 'f' TypeSymlink = 'l' TypeHardlink = 'h' TypeBlockDevice = 'b' TypeCharDevice = 'c' TypeFifo = 'p' TypeSocket = 's' )
Entry type bytes as stored on disk.
Variables ¶
var Magic = []byte{145, 253, 96, 249, 196, 103, 88, 213}
Magic identifies a .pcat1 catalog (PROXMOX_CATALOG_FILE_MAGIC_1_0).
Functions ¶
This section is empty.
Types ¶
type Entry ¶
Entry is one decoded catalog entry. Directories carry Children; files carry Size and MtimeSecs. Decode returns a synthetic root directory whose children are the archive entries.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer streams a .pcat1 catalog. Directory tables are written bottom-up as directories close, so parents reference children by backward delta; entries within a table appear in the order they were added (canonical: sorted walk order, directories recorded when they close).
Usage: NewWriter, StartDirectory(archiveName), Add*/nested directories, EndDirectory, Finish. The top-level directory conventionally carries the archive's index name (e.g. "root.pxar.didx"); a catalog may hold several.
func (*Writer) AddBlockDevice ¶
func (*Writer) AddCharDevice ¶
func (*Writer) AddHardlink ¶
func (*Writer) AddSymlink ¶
AddSymlink, AddHardlink, AddBlockDevice, AddCharDevice, AddFifo and AddSocket record name-only entries of the respective type.
func (*Writer) EndDirectory ¶
EndDirectory encodes and writes the current directory's table and records it in the parent.
func (*Writer) Finish ¶
Finish writes the root table and the trailing little-endian u64 pointing at it. The Writer is unusable afterwards.
func (*Writer) StartDirectory ¶
StartDirectory opens a directory (or, at the top level, an archive entry).