fileshash

package
v0.0.0-...-985cc99 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRootNotFound = errors.New("hashes root not found")
	ErrRootMismatch = errors.New("hashes root mismatch")
	ErrHashMismatch = errors.New("hash mismatch")
	ErrTooMuchMem   = errors.New("hashed file requires too much memory")
	ErrInit         = errors.New("failed to init hashfile")
	ErrPieceRead    = errors.New("failed to read piece")
	ErrClosed       = errors.New("closed")
)

Functions

func Wrap

func Wrap(backend func(string) (io.Reader, error), maxMemoryUsage uint64, roots map[string]hash.Hash) func(string) (io.Reader, error)

Types

type Map

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

type Reader

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

func WrapReader

func WrapReader(backend io.Reader, maxMemUsage uint64, root hash.Hash) *Reader

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

type TmpWriter

type TmpWriter interface {
	io.ReadWriteSeeker
	io.Closer
	Drop() error
}

type Writer

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

func WrapWriter

func WrapWriter(backend io.Writer, pieceSize uint64, openTmp func(int) TmpWriter) *Writer

func (*Writer) Flush

func (w *Writer) Flush() (hash.Hash, error)

func (*Writer) Root

func (w *Writer) Root() hash.Hash

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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