Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlobSourceInterface ¶
type BlobSourceInterface interface {
UseBlob(ctx context.Context, hashObj core.HashObj, useFunc func([]byte) error) error
}
BlobSourceInterface serves a blob by hash; useFunc is invoked exactly once, synchronously.
type FormatType ¶
type FormatType string
FormatType is an archive format; see the Format constants.
const ( // FormatZip is the zip format. FormatZip FormatType = "zip" // FormatTar is the tar format. FormatTar FormatType = "tar" // FormatTarGz is the tar.gz format. FormatTarGz FormatType = "tar.gz" )
func (FormatType) String ¶
func (obj FormatType) String() string
String returns the textual format representation.
type LimitsObj ¶
type LimitsObj struct {
MaxArchiveSize uint64
MaxArchiveUnpackedSize uint64
MaxArchiveFileBytes uint64
MaxArchiveFiles uint
MaxArchivePathBytes uint
}
LimitsObj contains caps against zip/tar bombs and abuse: compressed and unpacked size, file size and count, and path length. All non-size fields are required; 0 in size fields means unlimited.
type Obj ¶
type Obj struct {
// contains filtered or unexported fields
}
Obj is the archive extract/write engine; it keeps anti-bomb and anti-traversal limits and is immutable after New.
func (*Obj) Extract ¶
Extract unpacks an archive into temporary blobs under anti-bomb and anti-traversal limits. On error the created blobs are deleted and no result is returned.
func (*Obj) Write ¶
func (obj *Obj) Write(ctx context.Context, requestObj WriteRequestObj) (WriteResultObj, error)
Write builds an archive from the validated entry list under limits. Output is deterministic: fixed mode/time, sorted paths, rejected conflicts, duplicates and symlink targets.
func (*Obj) WriteTree ¶
func (obj *Obj) WriteTree(ctx context.Context, requestObj WriteTreeRequestObj) (WriteResultObj, error)
WriteTree reads the tree by hash from Source and builds the archive via Write.
type RequestObj ¶
type RequestObj struct {
Key string
Version string
Format FormatType
SourcePath string
SourceSizeBytes uint64
SpoolPath string
// contains filtered or unexported fields
}
RequestObj is an extraction request: format, source path, and spool directory for temporary blobs.
type ResultObj ¶
type ResultObj struct {
Entries []core.StagedEntryObj
Blobs []core.StagedBlobObj
DroppedSymlinks []string
}
ResultObj is the extraction result: canonical tree entry paths and deduplicated staged blobs.
type TreeSourceInterface ¶
type TreeSourceInterface interface {
BlobSourceInterface
ReadTree(ctx context.Context, treeHashObj core.HashObj) ([]core.TreeEntryObj, error)
}
TreeSourceInterface adds reading a version tree by hash.
type WriteRequestObj ¶
type WriteRequestObj struct {
Format FormatType
Writer io.Writer
Entries []core.TreeEntryObj
Source BlobSourceInterface
}
WriteRequestObj describes writing an archive from a ready-made list of entries.
type WriteResultObj ¶
WriteResultObj records the entry count and the actually written body size.
type WriteTreeRequestObj ¶
type WriteTreeRequestObj struct {
Format FormatType
Writer io.Writer
TreeHash core.HashObj
Source TreeSourceInterface
}
WriteTreeRequestObj describes writing an archive by tree hash; entries are read from Source.