fspool

package
Version: 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: 9 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ModeMask is or'd with the permission files being opened
	ModeMask = 0o644
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FsPool

type FsPool struct {
	UniqueReader fsEntryReader
	// contains filtered or unexported fields
}

FsPool is a filesystem-backed Pool+WritablePool

func New

func New(c *tlc.Container, basePath string) *FsPool

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

func (*FsPool) Close

func (cfp *FsPool) Close() error

Close closes all reader belonging to this FsPool

func (*FsPool) FixExistingCase

func (cfp *FsPool) FixExistingCase(params lake.CaseFixParams) error

func (*FsPool) GetPath

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

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

func (*FsPool) GetReadSeeker

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

GetReadSeeker is like GetReader but the returned object allows seeking

func (*FsPool) GetReader

func (cfp *FsPool) 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 (*FsPool) GetRelativePath

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

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

func (*FsPool) GetSize

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

GetSize returns the size of the file at index fileIndex

func (*FsPool) GetWriter

func (cfp *FsPool) GetWriter(fileIndex int64) (io.WriteCloser, error)

GetWriter returns a writer for one of the container's file. It creates the file if it doesn't exist, and always truncates it.

type ReadCloseSeeker

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

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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL