log_reader

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChunkSize is used to predict the timestamp schema and timestamps.
	ChunkSize = 32 * 1024 // 32KB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogIterator

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

LogIterator iterates over StampedLogs in order.

func NewLogIterator

func NewLogIterator(lr *LogReader) (*LogIterator, error)

NewLogIterator creates a new LogIterator instance.

func (*LogIterator) Next

func (it *LogIterator) Next() (*StampedLog, bool)

Next returns the next StampedLog.

type LogReader

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

LogReader reads and parses log files.

func NewLogReader

func NewLogReader(reader io.ReadSeeker, name string) (*LogReader, error)

NewLogReader creates a new LogReader instance.

func (*LogReader) GetEndTimestamp

func (lr *LogReader) GetEndTimestamp() (*time.Time, error)

GetEndTimestamp returns the last timestamp in the log file.

func (*LogReader) GetStartTimestamp

func (lr *LogReader) GetStartTimestamp() (*time.Time, error)

GetStartTimestamp returns the first timestamp in the log file.

func (*LogReader) GetTimestampFormat

func (lr *LogReader) GetTimestampFormat() TimestampFormat

GetTimestampFormat returns the timestamp format used in the log file.

type OrderedQueue

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

OrderedQueue maintains order of StampedLog elements.

func NewOrderedQueue

func NewOrderedQueue(size int) *OrderedQueue

NewOrderedQueue creates a new OrderedQueue instance.

func (*OrderedQueue) Consume

func (oq *OrderedQueue) Consume(log *StampedLog) *StampedLog

Consume adds a new log to the queue and returns the oldest log if queue is full.

func (*OrderedQueue) DumpRemaining

func (oq *OrderedQueue) DumpRemaining() []*StampedLog

DumpRemaining returns all remaining logs in order.

type StampedLog

type StampedLog struct {
	Timestamp *time.Time
	Line      string
	Offset    int64
	Length    int64
}

StampedLog represents a log line with its timestamp.

type TimestampFormat

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

type TimestampHeap

type TimestampHeap []*StampedLog

TimestampHeap implements heap.Interface for StampedLog.

func (*TimestampHeap) Len

func (h *TimestampHeap) Len() int

func (*TimestampHeap) Less

func (h *TimestampHeap) Less(i, j int) bool

func (*TimestampHeap) Pop

func (h *TimestampHeap) Pop() interface{}

func (*TimestampHeap) Push

func (h *TimestampHeap) Push(x interface{})

func (*TimestampHeap) Swap

func (h *TimestampHeap) Swap(i, j int)

Jump to

Keyboard shortcuts

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