reader

package
v0.90.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	FingerprintSize         int
	MaxLogSize              int
	Emit                    emit.Callback
	IncludeFileName         bool
	IncludeFilePath         bool
	IncludeFileNameResolved bool
	IncludeFilePathResolved bool
	DeleteAtEOF             bool
	FlushTimeout            time.Duration
}

type Factory

type Factory struct {
	*zap.SugaredLogger
	Config        *Config
	FromBeginning bool
	Encoding      encoding.Encoding
	HeaderConfig  *header.Config
	SplitFunc     bufio.SplitFunc
	TrimFunc      trim.Func
}

func (*Factory) NewFingerprint

func (f *Factory) NewFingerprint(file *os.File) (*fingerprint.Fingerprint, error)

func (*Factory) NewReader

func (f *Factory) NewReader(file *os.File, fp *fingerprint.Fingerprint) (*Reader, error)

func (*Factory) NewReaderFromMetadata added in v0.89.0

func (f *Factory) NewReaderFromMetadata(file *os.File, m *Metadata) (r *Reader, err error)

type Metadata

type Metadata struct {
	Fingerprint     *fingerprint.Fingerprint
	Offset          int64
	FileAttributes  map[string]any
	HeaderFinalized bool
	FlushState      *flush.State
}

type Reader

type Reader struct {
	*Config
	*Metadata
	// contains filtered or unexported fields
}

Reader manages a single file

func (*Reader) Close

func (r *Reader) Close() *Metadata

Close will close the file and return the metadata

func (*Reader) NameEquals added in v0.88.0

func (r *Reader) NameEquals(other *Reader) bool

func (*Reader) NewFingerprintFromFile

func (r *Reader) NewFingerprintFromFile() (*fingerprint.Fingerprint, error)

func (*Reader) Read

func (r *Reader) Read(dst []byte) (int, error)

Read from the file and update the fingerprint if necessary

func (*Reader) ReadToEnd

func (r *Reader) ReadToEnd(ctx context.Context)

ReadToEnd will read until the end of the file

func (*Reader) Validate added in v0.88.0

func (r *Reader) Validate() bool

Validate returns true if the reader still has a valid file handle, false otherwise.

Jump to

Keyboard shortcuts

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