Documentation ¶
Index ¶
- Constants
- func CompressSnapshot(data io.ReadCloser, compressionPolicy string) (io.ReadCloser, error)
- func DecompressSnapshot(data io.ReadCloser, compressionPolicy string) (io.ReadCloser, error)
- func GetCompressionSuffix(compressionEnabled bool, compressionPolicy string) (string, error)
- func IsSnapshotCompressed(compressionSuffix string) (bool, string, error)
- type CompressionConfig
Constants ¶
const ( // GzipCompressionPolicy is constant for gzip compression algorithm. GzipCompressionPolicy = "gzip" // LzwCompressionPolicy is constant for lzw compression algorithm. LzwCompressionPolicy = "lzw" // ZlibCompressionPolicy is constant for zlib compression algorithm. ZlibCompressionPolicy = "zlib" // DefaultCompression is constant used for whether to compress the snapshots or not. DefaultCompression = false // DefaultCompressionPolicy is constant for default compression algorithm(only if compression is enabled). DefaultCompressionPolicy = "gzip" // UnCompressSnapshotExtension is used for snapshot suffix when compression is not enabled. UnCompressSnapshotExtension = "" // GzipCompressionExtension is used for snapshot suffix when compressionPolicy is gzip. GzipCompressionExtension = ".gz" // LzwCompressionExtension is used for snapshot suffix when compressionPolicy is lzw. LzwCompressionExtension = ".Z" // ZlibCompressionExtension is used for snapshot suffix when compressionPolicy is zlib. ZlibCompressionExtension = ".zlib" // LzwLiteralWidth is constant used as literal Width in lzw compressionPolicy. LzwLiteralWidth = 8 //[2,8] )
Variables ¶
This section is empty.
Functions ¶
func CompressSnapshot ¶
func CompressSnapshot(data io.ReadCloser, compressionPolicy string) (io.ReadCloser, error)
CompressSnapshot takes uncompressed data as input and compress the data according to Compression Policy and write the compressed data into one end of pipe.
func DecompressSnapshot ¶
func DecompressSnapshot(data io.ReadCloser, compressionPolicy string) (io.ReadCloser, error)
DecompressSnapshot take compressed data and compressionPolicy as input and it decompresses the data according to compression Policy and return uncompressed data.
func GetCompressionSuffix ¶
GetCompressionSuffix returns the suffix for snapshot w.r.t Compression Policy if compression is not enabled, it will simply return UnCompressSnapshotExtension(empty string).
Types ¶
type CompressionConfig ¶
type CompressionConfig struct { Enabled bool `json:"enabled"` CompressionPolicy string `json:"policy,omitempty"` }
CompressionConfig holds the compression configuration.
func NewCompressorConfig ¶
func NewCompressorConfig() *CompressionConfig
NewCompressorConfig returns the compression config.
func (*CompressionConfig) AddFlags ¶
func (c *CompressionConfig) AddFlags(fs *flag.FlagSet)
AddFlags adds the flags to flagset.
func (*CompressionConfig) Validate ¶
func (c *CompressionConfig) Validate() error
Validate validates the compression Config.