Documentation
¶
Overview ¶
Package compression provides compression support for JVS snapshots. It supports gzip compression at configurable levels for snapshot data.
Index ¶
- func CompressedPath(path string) string
- func DecompressDir(root string) (int, error)
- func DecompressFile(path string) (string, error)
- func IsCompressedFile(path string) bool
- func UncompressedPath(path string) string
- type CompressionLevel
- type CompressionType
- type Compressor
- type MaterializedSizePlan
- type SnapshotCompressionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressedPath ¶
CompressedPath returns the compressed path for a file.
func DecompressDir ¶
DecompressDir decompresses only files listed in the root .READY compression manifest. User-owned .gz files and symlinks are left untouched. Returns the count of decompressed files and any error.
func DecompressFile ¶
DecompressFile decompresses a .gz file and returns the decompressed path. If the file is not compressed, returns the original path.
func IsCompressedFile ¶
IsCompressedFile returns true if the file path indicates a compressed file.
func UncompressedPath ¶
UncompressedPath returns the uncompressed path for a file.
Types ¶
type CompressionLevel ¶
type CompressionLevel int
CompressionLevel represents the compression level.
const ( // LevelNone disables compression. LevelNone CompressionLevel = 0 // LevelFast uses fastest compression (gzip level 1). LevelFast CompressionLevel = 1 // LevelDefault uses default compression (gzip level 6). LevelDefault CompressionLevel = 6 // LevelMax uses maximum compression (gzip level 9). LevelMax CompressionLevel = 9 )
type CompressionType ¶
type CompressionType string
CompressionType represents the compression algorithm.
const ( // TypeGzip uses gzip compression. TypeGzip CompressionType = "gzip" // TypeNone indicates no compression. TypeNone CompressionType = "none" )
type Compressor ¶
type Compressor struct {
Type CompressionType
Level CompressionLevel
}
Compressor handles compression operations.
func NewCompressor ¶
func NewCompressor(level CompressionLevel) *Compressor
NewCompressor creates a new compressor with the specified level. Level 0 means no compression.
func NewCompressorFromString ¶
func NewCompressorFromString(level string) (*Compressor, error)
NewCompressorFromString creates a compressor from a string level. Valid values: "none", "fast", "default", "max"
func (*Compressor) CompressDir ¶
func (c *Compressor) CompressDir(root string) (int, error)
CompressDir compresses eligible regular files in a snapshot directory tree and records the compressed paths in the root .READY marker. Returns the count of compressed files and any error.
func (*Compressor) CompressFile ¶
func (c *Compressor) CompressFile(path string) (string, error)
CompressFile compresses a file and returns the compressed path. The compressed file has a .gz extension added. If compression is disabled, returns the original path.
func (*Compressor) IsEnabled ¶
func (c *Compressor) IsEnabled() bool
IsEnabled returns true if compression is enabled.
func (*Compressor) String ¶
func (c *Compressor) String() string
String returns the string representation of the compressor.
type MaterializedSizePlan ¶
func PlanMaterializedSize ¶
func PlanMaterializedSize(root string) (*MaterializedSizePlan, error)
type SnapshotCompressionInfo ¶
type SnapshotCompressionInfo struct {
Type CompressionType `json:"type,omitempty"`
Level CompressionLevel `json:"level,omitempty"`
}
SnapshotCompressionInfo stores compression metadata in the descriptor.
func CompressionInfoFromLevel ¶
func CompressionInfoFromLevel(level string) (*SnapshotCompressionInfo, error)
CompressionInfoFromLevel creates compression info from a level string.
func (*SnapshotCompressionInfo) String ¶
func (ci *SnapshotCompressionInfo) String() string
String returns the string representation of the compression info.