checker

package
v0.0.0-...-6034e87 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrotliCompress

func BrotliCompress(input []byte, level int) ([]byte, error)

func Bzip2Compress

func Bzip2Compress(input []byte) ([]byte, error)

func FlateCompress

func FlateCompress(input []byte) ([]byte, error)

func GzipCompress

func GzipCompress(input []byte) ([]byte, error)

func MakeTar

func MakeTar(t *testing.T, sink *Sink) []byte

func MakeZip

func MakeZip(t *testing.T, sink *Sink) []byte

func NewTestSaveConsumer

func NewTestSaveConsumer(threshold int64, onSave OnSaveFunc) savior.SaveConsumer

func RunExtractorText

func RunExtractorText(t *testing.T, makeExtractor MakeExtractorFunc, sink *Sink, shouldSave ShouldSaveFunc)

func RunSourceTest

func RunSourceTest(t *testing.T, source savior.Source, reference []byte)

Types

type DoneItem

type DoneItem struct {
	MinWrite int64
	MaxWrite int64
	Linkname string
}

DoneItem represents the result of an item having been written to

type Item

type Item struct {
	Entry *savior.Entry
	Data  []byte
}

Item represents a savior.Entry + bytes pair

type MakeExtractorFunc

type MakeExtractorFunc func() savior.Extractor

type OnSaveFunc

type OnSaveFunc func(checkpoint *savior.ExtractorCheckpoint) (savior.AfterSaveAction, error)

type ShouldSaveFunc

type ShouldSaveFunc func() bool

type Sink

type Sink struct {
	Items     map[string]*Item
	DoneItems map[string]*DoneItem
}

Sink is a special kind of savior.Sink that records statistics about what's written to assist in unit testing.

func MakeTestSink

func MakeTestSink() *Sink

func MakeTestSinkAdvanced

func MakeTestSinkAdvanced(numEntries int) *Sink

func NewSink

func NewSink() *Sink

NewSink returns a new checker sink

func (*Sink) Close

func (cs *Sink) Close() error

func (*Sink) GetWriter

func (cs *Sink) GetWriter(entry *savior.Entry) (savior.EntryWriter, error)

func (*Sink) Mkdir

func (cs *Sink) Mkdir(entry *savior.Entry) error

func (*Sink) Nuke

func (cs *Sink) Nuke() error

func (*Sink) Preallocate

func (cs *Sink) Preallocate(entry *savior.Entry) error

func (*Sink) Reset

func (cs *Sink) Reset()
func (cs *Sink) Symlink(entry *savior.Entry, linkname string) error

func (*Sink) Validate

func (cs *Sink) Validate() error

type Writer

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

func NewWriter

func NewWriter(reference []byte) *Writer

func (*Writer) Seek

func (cw *Writer) Seek(offset int64, whence int) (int64, error)

func (*Writer) Write

func (cw *Writer) Write(buf []byte) (int, error)

Jump to

Keyboard shortcuts

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