reader

package
v0.101.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxLogSize  = 1024 * 1024
	DefaultFlushPeriod = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	component.TelemetrySettings
	HeaderConfig      *header.Config
	FromBeginning     bool
	FingerprintSize   int
	InitialBufferSize int
	MaxLogSize        int
	Encoding          encoding.Encoding
	SplitFunc         bufio.SplitFunc
	TrimFunc          trim.Func
	FlushTimeout      time.Duration
	EmitFunc          emit.Callback
	Attributes        attrs.Resolver
	DeleteAtEOF       bool
}

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
}

func (Metadata) GetFingerprint added in v0.93.0

func (m Metadata) GetFingerprint() *fingerprint.Fingerprint

type Reader

type Reader struct {
	*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) Read

func (r *Reader) Read(dst []byte) (n int, err 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