Documentation
¶
Overview ¶
Package accessor provides random access to pxar archives.
Index ¶
- type Accessor
- func (a *Accessor) ListDirectory(dirOffset int64) ([]pxar.Entry, error)
- func (a *Accessor) ListDirectoryWithOptions(dirOffset int64, opts ListOption) ([]pxar.Entry, error)
- func (a *Accessor) Lookup(path string) (*pxar.Entry, error)
- func (a *Accessor) LookupBatch(paths []string) ([]*pxar.Entry, error)
- func (a *Accessor) ReadEntryAt(offset int64) (*pxar.Entry, error)
- func (a *Accessor) ReadEntryAtMinimal(offset int64) (*pxar.Entry, error)
- func (a *Accessor) ReadFileContent(entry *pxar.Entry) ([]byte, error)
- func (a *Accessor) ReadFileContentReader(entry *pxar.Entry) (io.ReadCloser, error)
- func (a *Accessor) ReadRoot() (*pxar.Entry, error)
- type ListOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accessor ¶
type Accessor struct {
// contains filtered or unexported fields
}
Accessor provides random access to entries in a pxar archive.
func NewAccessor ¶
func NewAccessor(reader io.ReadSeeker, payloadReader ...io.ReadSeeker) *Accessor
NewAccessor creates an accessor for random access to a pxar archive. For split archives (v2 format), provide the payload reader as the second argument.
func (*Accessor) ListDirectory ¶
ListDirectory lists entries in a directory at the given offset. The offset should point to the start of the directory's FILENAME range.
func (*Accessor) ListDirectoryWithOptions ¶ added in v0.10.0
ListDirectoryWithOptions lists entries with selective metadata decoding. When opts.Minimal is true, extended metadata (xattrs, fcaps, ACLs) is skipped — only stat basics are decoded.
func (*Accessor) LookupBatch ¶ added in v0.10.0
LookupBatch looks up multiple paths in a single pass. It is more efficient than N separate Lookup calls because it shares directory traversals for common prefixes.
func (*Accessor) ReadEntryAt ¶
ReadEntryAt reads a pxar entry at the given archive offset.
func (*Accessor) ReadEntryAtMinimal ¶ added in v0.10.0
ReadEntryAtMinimal reads a pxar entry with minimal decoding. It skips extended metadata (xattrs, fcaps, ACLs, quota project ID) and only populates stat basics. Use for indexing/browsing where full metadata is unnecessary.
func (*Accessor) ReadFileContent ¶
ReadFileContent reads the content of a file entry from the archive.
func (*Accessor) ReadFileContentReader ¶ added in v0.10.0
ReadFileContentReader returns a streaming reader for file content. The caller must close the returned reader when done. This avoids materializing the entire file in memory.
type ListOption ¶ added in v0.10.0
type ListOption struct {
// Minimal skips decoding xattrs, fcaps, ACLs, and other extended
// metadata. Only stat basics (mode, uid, gid, times) are populated.
// Significantly reduces per-entry decode cost.
Minimal bool
}
ListOption controls which metadata is decoded during ListDirectory.