logview

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BufSize = 256 * 1024
View Source
const MaxLineSize = 1024

Variables

View Source
var ErrBOF = errors.New("beginning of file")

Functions

This section is empty.

Types

type LinePtr

type LinePtr struct {
	Offset      int64
	RealLineNum int64
	LineNum     int64
}

type LogView

type LogView struct {
	File     *os.File
	MultiBuf *MultiBufferByteGetter
	MatchRe  *regexp.Regexp
}

func MakeLogView

func MakeLogView(file *os.File) *LogView

func (*LogView) Close

func (lv *LogView) Close()

func (*LogView) FirstLinePtr

func (lv *LogView) FirstLinePtr() (*LinePtr, error)

func (*LogView) LastLinePtr

func (lv *LogView) LastLinePtr(linePtr *LinePtr) (*LinePtr, error)

func (*LogView) Move

func (lv *LogView) Move(linePtr *LinePtr, offset int) (int, *LinePtr, error)

func (*LogView) NextLinePtr

func (lv *LogView) NextLinePtr(linePtr *LinePtr) (*LinePtr, error)

func (*LogView) PrevLinePtr

func (lv *LogView) PrevLinePtr(linePtr *LinePtr) (*LinePtr, error)

func (*LogView) ReadLineData

func (lv *LogView) ReadLineData(linePtr *LinePtr) ([]byte, error)

func (*LogView) ReadWindow

func (lv *LogView) ReadWindow(linePtr *LinePtr, winSize int) ([][]byte, error)

type MultiBufferByteGetter

type MultiBufferByteGetter struct {
	File    *os.File
	Offset  int64
	EOF     bool
	Buffers [][]byte
	BufSize int64
}

func MakeMultiBufferByteGetter

func MakeMultiBufferByteGetter(file *os.File, bufSize int64) *MultiBufferByteGetter

func (*MultiBufferByteGetter) GetByte

func (mb *MultiBufferByteGetter) GetByte(offset int64) (byte, error)

func (*MultiBufferByteGetter) NextLine

func (mb *MultiBufferByteGetter) NextLine(offset int64) (int64, error)

func (*MultiBufferByteGetter) PrevLine

func (mb *MultiBufferByteGetter) PrevLine(offset int64) (int64, error)

Jump to

Keyboard shortcuts

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