zippool

package
v0.0.0-...-cc4284e Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadCloseSeeker

type ReadCloseSeeker interface {
	io.Reader
	io.Seeker
	io.Closer
}

ReadCloseSeeker unifies io.Reader, io.Seeker, and io.Closer

type ZipPool

type ZipPool struct {
	// contains filtered or unexported fields
}

ZipPool implements the lake.ZipPool interface based on a Container

func New

func New(c *tlc.Container, zipReader *zip.Reader) *ZipPool

NewZipPool creates a new ZipPool from the given Container metadata and a base path on-disk to allow reading from files.

func (*ZipPool) Close

func (cfp *ZipPool) Close() error

Close closes all reader belonging to this ZipPool

func (*ZipPool) GetPath

func (cfp *ZipPool) GetPath(fileIndex int64) string

GetPath returns the native path of a file (with slashes or backslashes) on-disk, based on the ZipPool's base path

func (*ZipPool) GetReadSeeker

func (cfp *ZipPool) GetReadSeeker(fileIndex int64) (io.ReadSeeker, error)

GetReadSeeker is like GetReader but the returned object allows seeking

func (*ZipPool) GetReader

func (cfp *ZipPool) GetReader(fileIndex int64) (io.Reader, error)

GetReader returns an io.Reader for the file at index fileIndex Successive calls to `GetReader` will attempt to re-use the last returned reader if the file index is similar. The cache size is 1, so reading in parallel from different files is not supported.

func (*ZipPool) GetRelativePath

func (cfp *ZipPool) GetRelativePath(fileIndex int64) string

GetRelativePath returns the slashed path of a file, relative to the container's root.

func (*ZipPool) GetSize

func (cfp *ZipPool) GetSize(fileIndex int64) int64

GetSize returns the size of the file at index fileIndex

Jump to

Keyboard shortcuts

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