reader

package
v0.124.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

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

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
	BufPool                 sync.Pool
	InitialBufferSize       int
	MaxLogSize              int
	Encoding                encoding.Encoding
	SplitFunc               bufio.SplitFunc
	TrimFunc                trim.Func
	FlushTimeout            time.Duration
	EmitFunc                emit.Callback
	Attributes              attrs.Resolver
	DeleteAtEOF             bool
	IncludeFileRecordNumber bool
	Compression             string
	AcquireFSLock           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
	RecordNum       int64
	FileAttributes  map[string]any
	HeaderFinalized bool
	FlushState      flush.State
	TokenLenState   tokenlen.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) GetFileName added in v0.102.0

func (r *Reader) GetFileName() string

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