filepool

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPoolSizeLessThanZero = errors.New("pool size must be greater than zero")

Functions

This section is empty.

Types

type File

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

File is a file backed buffer.

func (*File) Checksum

func (f *File) Checksum() uint32

func (*File) Hasher

func (f *File) Hasher() io.Writer

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

func (*File) Write

func (f *File) Write(p []byte) (n int, err error)

func (*File) Written

func (f *File) Written() uint64

type FilePool

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

FilePool represents a pool of files that can be used as buffers.

func New

func New(dir string, poolSize int, bufferSize int) (*FilePool, error)

New returns a new FilePool.

func (*FilePool) Close

func (fp *FilePool) Close() error

Close closes and removes all files in the pool.

func (*FilePool) Get

func (fp *FilePool) Get() *File

Get gets a file from the pool.

func (*FilePool) Put

func (fp *FilePool) Put(f *File)

Put puts a file back into the pool.

Jump to

Keyboard shortcuts

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