casblob

package
v0.0.0-...-2898a4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractLogicalSize

func ExtractLogicalSize(rc io.ReadCloser) (io.ReadCloser, int64, error)

Extract the logical size of a v2 cas blob from rc, and return that size along with an equivalent io.ReadCloser to rc.

func GetLegacyZstdReadCloser

func GetLegacyZstdReadCloser(zstd zstdimpl.ZstdImpl, f *os.File) (io.ReadCloser, error)

GetLegacyZstdReadCloser returns an io.ReadCloser that provides zstandard-compressed data from an uncompressed file.

func GetUncompressedReadCloser

func GetUncompressedReadCloser(zstd zstdimpl.ZstdImpl, f *os.File, expectedSize int64, offset int64) (io.ReadCloser, error)

Returns an io.ReadCloser that provides uncompressed data. The caller must close the returned io.ReadCloser if it is non-nil. Doing so will automatically close f. If there is an error f will be closed, the caller does not need to do so.

func GetZstdReadCloser

func GetZstdReadCloser(zstd zstdimpl.ZstdImpl, f *os.File, expectedSize int64, offset int64) (io.ReadCloser, error)

Returns an io.ReadCloser that provides zstandard compressed data. The caller must close the returned io.ReadCloser if it is non-nil. Doing so will automatically close f. If there is an error f will be closed, the caller does not need to do so.

func WriteAndClose

func WriteAndClose(zstd zstdimpl.ZstdImpl, r io.Reader, f *os.File, t CompressionType, hash string, size int64) (int64, error)

Read from r and write to f, using CompressionType t. Return the size on disk or an error if something went wrong.

Types

type CompressionType

type CompressionType uint8
const (
	Identity  CompressionType = 0
	Zstandard CompressionType = 1
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL