Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLastSeparatorPosition ¶
func GetLastSeparatorPosition(fileHandler io.ReadSeeker) int64
GetLastSeparatorPosition returns first occurrence of '\n', reading file chunk by chunk from the end returns zero in case of IO errors (unlikely) or missing separator note: does not keep current file cursor for easiness’ sake
func JournaldPath ¶
JournaldPath tries to construct path to system journal from machine ID and base path
Types ¶
type Cursor ¶
Cursor position in file
func NewCursorFromString ¶
NewCursorFromString is a constructor
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
LineReader is used for reading lines from file. Signals about rotations (fs notify rename)
func NewLineReader ¶
func NewLineReader(filePath string, bufferSize int, initialCursor *Cursor, fromTailFlag bool) (*LineReader, error)
NewLineReader is a constructor for LineReader
func (*LineReader) Close ¶
func (reader *LineReader) Close() error
Close should be used as LineReader finalizer
func (*LineReader) EntryRead ¶
func (reader *LineReader) EntryRead() ([]byte, bool, error)
EntryRead returns one line from file, cutting off line ending if it's not the last line and tries to handle rotation
func (*LineReader) GetAcquireFlag ¶
func (reader *LineReader) GetAcquireFlag() bool
GetAcquireFlag should be used to check if ReaderJournald is able to provide data
func (*LineReader) GetCursor ¶
func (reader *LineReader) GetCursor() *Cursor
GetCursor should be used to get current reader in-memory cursor
type ReaderJournald ¶
type ReaderJournald struct {
// contains filtered or unexported fields
}
ReaderJournald is not ReaderJournald in Go stdlib sense. Postponed naming issue.
func NewReaderJournald ¶
func NewReaderJournald(journalPath string, initialCursor string) (*ReaderJournald, error)
NewReaderJournald is a constructor for ReaderJournald instance
func (*ReaderJournald) Close ¶
func (reader *ReaderJournald) Close() error
Close should be used as reader finalizer
func (*ReaderJournald) EntryRead ¶
func (reader *ReaderJournald) EntryRead() (common.EntryMap, error)
EntryRead gets new entry
func (*ReaderJournald) GetAcquireFlag ¶
func (reader *ReaderJournald) GetAcquireFlag() bool
GetAcquireFlag should be used for checking if reader is ready
func (*ReaderJournald) GetCursor ¶
func (reader *ReaderJournald) GetCursor() string
GetCursor should be used to get current reader in-memory cursor; journald cursor is not so complex as lineReader's one, so it's just a string