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 ¶
Read reads the next event from the journal. It returns io.EOF when all events have been read.
func (*JSONLReader) ReadWithOffset ¶
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.