scanner

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRecordSize = pool.MaxRecordSize
)

Variables

View Source
var (
	ErrInvalidWindow   = errors.New("invalid window")
	ErrInvalidCallback = errors.New("invalid callback")
)

Functions

func ScanForward

func ScanForward(rdr io.Reader, parseF ParseFuncT, scanF ScanFuncT, opts ...ScanOptT) error

func ScanReverse

func ScanReverse(src io.ReaderAt, parseF ParseFuncT, scanF ScanFuncT, opts ...ScanOptT) error

Types

type ErrFuncT

type ErrFuncT func([]byte, error) error

type ExprT

type ExprT struct {
	RegEx *regexp.Regexp
	Mode  ModeT
}

type LogEntry

type LogEntry = entry.LogEntry

type MatchFlagT

type MatchFlagT int
const (
	MatchForceUTF16 MatchFlagT = 1 << iota
)

type MatchScan

type MatchScan struct {
	Sz    int
	MaxSz int
	Clip  bool
	Logs  []LogEntry
	// contains filtered or unexported fields
}

func NewMatchScan

func NewMatchScan(maxSz int, flags MatchFlagT, exprs []ExprT) *MatchScan

func (*MatchScan) Bind

func (sr *MatchScan) Bind() func(entry LogEntry) bool

type ModeT

type ModeT int
const (
	ModeEnrich ModeT = iota
	ModeJump
	ModeFilter
	ModeInvert
)

type ParseFuncT

type ParseFuncT func([]byte) (LogEntry, error)

type ROpt

type ROpt func(*roptT)

func WithMemoryLimit

func WithMemoryLimit(limit int) ROpt

type ReorderT

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

func NewReorder

func NewReorder(window int64, cb ScanFuncT, opts ...ROpt) (*ReorderT, error)

func (*ReorderT) AdvanceClock

func (r *ReorderT) AdvanceClock(stamp int64) bool

Artificially advance the clock to the specified timestamp. This will cause any entries older than (clock - window) to be delivered. Returns true if done.

func (*ReorderT) Append

func (r *ReorderT) Append(entry LogEntry) (done bool)

Append a new log entry to the reorder buffer. Entry will be delivered to the callback when its timestamp is outside the window. Returns true if done, where done is indicated by the callback.

func (*ReorderT) Flush

func (r *ReorderT) Flush() (done bool)

Explicitly flush all pending entries and drain the reorder buffer. Returns true if done.

func (*ReorderT) Pending added in v0.0.18

func (r *ReorderT) Pending() bool

Return true if there are pending entries.

type ScanFuncT

type ScanFuncT func(entry LogEntry) bool

type ScanOptT

type ScanOptT func(*scanOpt)

func WithErrFunc

func WithErrFunc(errF ErrFuncT) ScanOptT

func WithFold

func WithFold(fold bool) ScanOptT

func WithMark

func WithMark(mark int64) ScanOptT

func WithMaxSize

func WithMaxSize(maxSz int) ScanOptT

func WithStart

func WithStart(start int64) ScanOptT

func WithStop

func WithStop(stop int64) ScanOptT

type StdReadScan

type StdReadScan struct {
	Sz    int
	MaxSz int
	Clip  bool
	Logs  []LogEntry
}

func NewStdReadScan

func NewStdReadScan(maxSz int) *StdReadScan

func (*StdReadScan) Scan

func (sr *StdReadScan) Scan(entry LogEntry) bool

Jump to

Keyboard shortcuts

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