journalreader

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONLReader

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

JSONLReader reads journal events from a JSONL file sequentially. It also tracks byte offsets: every event is one line, so the start offset of each line stays valid as long as the file is append-only.

func OpenJSONLReader

func OpenJSONLReader() (*JSONLReader, error)

OpenJSONLReader opens the journal file for reading and returns a reader that iterates over events sequentially. Each call creates a fresh file handle starting at the beginning of the journal.

func OpenJSONLReaderPath

func OpenJSONLReaderPath(path string) (*JSONLReader, error)

OpenJSONLReaderPath opens the journal file at the provided path for reading.

func (*JSONLReader) Close

func (r *JSONLReader) Close() error

Close closes the underlying journal file.

func (*JSONLReader) Read

func (r *JSONLReader) Read(ctx context.Context) (*journal.Event, error)

Read reads the next event from the journal. It returns io.EOF when all events have been read.

func (*JSONLReader) ReadWithOffset

func (r *JSONLReader) ReadWithOffset(ctx context.Context) (*journal.Event, int64, error)

ReadWithOffset reads the next event and reports the byte offset where its line starts. The caller can Seek back to a reported offset later: offsets stay valid because the journal only ever appends whole lines.

func (*JSONLReader) SeekTo

func (r *JSONLReader) SeekTo(offset int64) error

SeekTo positions the reader at a byte offset previously reported by ReadWithOffset (or zero for the file start). The offset must be a line boundary; seeking mid-line reads garbage.

type Reader

type Reader interface {
	// Read reads the next event from the journal.
	// Returns io.EOF when all events have been consumed.
	Read(ctx context.Context) (*journal.Event, error)

	// Close closes the underlying journal file.
	Close() error
}

Reader reads events from the journal sequentially.

Jump to

Keyboard shortcuts

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