Skip to content

Commit

Permalink
sdjournal: add Rewind method to JournalReader
Browse files Browse the repository at this point in the history
This allows users of the JournalReader to rewind to the beginning of the
Journal.

Also add a missing docstring to JournalReader.Close
  • Loading branch information
jonboulle committed May 20, 2016
1 parent 48fe794 commit 0f21494
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sdjournal/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,16 @@ func (r *JournalReader) Read(b []byte) (int, error) {
return len(msg), nil
}

// Close closes the JournalReader's handle to the journal.
func (r *JournalReader) Close() error {
return r.journal.Close()
}

// Rewind attempts to rewind the JournalReader to the first entry.
func (r *JournalReader) Rewind() error {
return r.journal.SeekHead()
}

// Follow synchronously follows the JournalReader, writing each new journal entry to writer. The
// follow will continue until a single time.Time is received on the until channel.
func (r *JournalReader) Follow(until <-chan time.Time, writer io.Writer) (err error) {
Expand Down

0 comments on commit 0f21494

Please sign in to comment.